[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Container/Views/Browser - Contents.py:1.12 main.pt:1.13

runyaga runyaga@thisbox.com
Tue, 3 Dec 2002 09:02:56 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Container/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv18622

Modified Files:
	Contents.py main.pt 
Log Message:

added a formatTime method to the view and call it from the main.pt



=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Contents.py 1.11 => 1.12 ===
--- Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Contents.py:1.11	Sun Dec  1 05:32:28 2002
+++ Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/Contents.py	Tue Dec  3 09:02:56 2002
@@ -50,7 +50,7 @@
             created = dc.created
             if created is not None:
                 info['created'] = created
-
+            
             modified = dc.modified
             if modified is not None:
                 info['modified'] = modified
@@ -80,3 +80,10 @@
             return ''
 
         return self._index()
+
+    time_undefined=u'N/A'
+    time_format='%Y/%m/%d'
+    def formatTime(self, in_date):
+        if hasattr(in_date, 'strftime'):
+            return in_date.strftime(self.time_format) 
+        return self.time_undefined


=== Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/main.pt 1.12 => 1.13 ===
--- Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/main.pt:1.12	Mon Oct  7 11:44:42 2002
+++ Zope3/lib/python/Zope/App/OFS/Container/Views/Browser/main.pt	Tue Dec  3 09:02:56 2002
@@ -15,9 +15,7 @@
 </head>
 <body>
 <div metal:fill-slot="body">
-
 <div metal:define-macro="contents">
-
   <div>Contents <a href="+"> Add... </a> </div>
 
   <form name="containerContentsForm" method="get" action="." 
@@ -69,8 +67,10 @@
                  >foo</a> 
             </td>          
             <td><span tal:content="item/title|default">&nbsp;</span></td>
-            <td><span tal:content="item/created|default">&nbsp;</span></td>
-            <td><span tal:content="item/modified|default">&nbsp;</span></td>
+            <td><span tal:define="created item/created|default"
+                      tal:content="python:view.formatTime(created)">&nbsp;</span></td>
+            <td><span tal:define="modified item/modified|default"
+                      tal:content="python:view.formatTime(modified)">&nbsp;</span></td>
           </tr>
         </metal:block>
         </tbody>