[Zope3-checkins] CVS: Products3/NewsSite/NewsItem - browser.py:1.6 info.pt:1.6
Tres Seaver
tseaver@zope.com
Thu, 27 Mar 2003 07:12:08 -0500
Update of /cvs-repository/Products3/NewsSite/NewsItem
In directory cvs.zope.org:/tmp/cvs-serv1240/NewsItem
Modified Files:
browser.py info.pt
Log Message:
- Move date presentation logic into the view class (to handle better
the case when the date is None).
- Remove tabs, wrap long lines in the template.
=== Products3/NewsSite/NewsItem/browser.py 1.5 => 1.6 ===
--- Products3/NewsSite/NewsItem/browser.py:1.5 Thu Mar 27 06:13:19 2003
+++ Products3/NewsSite/NewsItem/browser.py Thu Mar 27 07:12:07 2003
@@ -42,3 +42,26 @@
member = u'Unknown'
return member
+
+ def createdString(self):
+ return self._dateString(getAdapter(self.context,
+ ICMFDublinCore).created)
+
+ def modifiedString(self):
+ return self._dateString(getAdapter(self.context,
+ ICMFDublinCore).modified)
+
+ def effectiveString(self):
+ return self._dateString(getAdapter(self.context,
+ ICMFDublinCore).effective)
+
+ def expiresString(self):
+ return self._dateString(getAdapter(self.context,
+ ICMFDublinCore).expires)
+
+ def _dateString(self, value):
+
+ if value is None:
+ return ''
+
+ return value.strftime('%Y-%m-%d')
=== Products3/NewsSite/NewsItem/info.pt 1.5 => 1.6 ===
--- Products3/NewsSite/NewsItem/info.pt:1.5 Wed Mar 26 14:15:17 2003
+++ Products3/NewsSite/NewsItem/info.pt Thu Mar 27 07:12:07 2003
@@ -4,14 +4,15 @@
</head>
<body>
<div metal:fill-slot="body">
- <h2 tal:content="context/title">News Message</h2>
- <p> Creator: <em tal:content="view/getCreator">Creator</em></p>
- <p> <em tal:content="context/lead">News Message</em></p>
- <p> <pre tal:content="context/newsbody">News Message</pre></p>
- <p>
- Effective: <span tal:content="python: context.effective.strftime('%Y-%m-%d')">News Message</span>
- Expires: <span tal:content="python: context.expires.strftime('%Y-%m-%d')">News Message</span>
- </p>
+<h2 tal:content="context/title">News Message</h2>
+<p> Creator: <em tal:content="view/getCreator">Creator</em></p>
+<p> <em tal:content="context/lead">News Message</em></p>
+<p> <pre tal:content="context/newsbody">News Message</pre></p>
+<p> Effective:
+ <span tal:content="view/effectiveString">Effective</span>
+ Expires:
+ <span tal:content="view/expiresString">News Message</span>
+</p>
</div>
</body>
</html>