[CMF-checkins] CVS: CMF/CMFCollector - CollectorIssue.py:1.49

Sidnei da Silva sidnei@x3ng.com.br
Sun, 16 Mar 2003 11:53:51 -0500


Update of /cvs-repository/CMF/CMFCollector
In directory cvs.zope.org:/tmp/cvs-serv6556

Modified Files:
	CollectorIssue.py 
Log Message:
Small fixes to date initialization

=== CMF/CMFCollector/CollectorIssue.py 1.48 => 1.49 ===
--- CMF/CMFCollector/CollectorIssue.py:1.48	Thu Nov  7 16:49:11 2002
+++ CMF/CMFCollector/CollectorIssue.py	Sun Mar 16 11:53:51 2003
@@ -600,7 +600,7 @@
         it._setPortalTypeName('Collector Issue Transcript')
         it.title = self.title
 
-    def _entry_header(self, type, user, prefix="= ", suffix=""):
+    def _entry_header(self, type, user, date=None, prefix="= ", suffix=""):
         """Return text for the header of a new transcript entry."""
         # Ideally this would be a skin method (probly python script), but i
         # don't know how to call it from the product, sigh.
@@ -609,9 +609,13 @@
             lead = t + " - Entry #" + str(self.action_number)
         else:
             lead = t
+        if date is None:
+            date = DateTime()
+        if not isinstance(date, DateTime):
+            date = DateTime(date)
 
         return ("%s%s by %s on %s%s" %
-                (prefix, lead, str(user), DateTime().aCommon(), suffix))
+                (prefix, lead, str(user), date.aCommon(), suffix))
 
     security.declareProtected(View, 'cited_text')
     def cited_text(self):
@@ -734,8 +738,10 @@
         # which i don't know how to set, if can should be done - so trying to
         # set an initial collector issue mod time is a noop when using with
         # pre-1.3 CMF.
+        if not isinstance(date, DateTime):
+            date = DateTime(date)
         if hasattr(self, 'setModificationDate'):
-            self.setModificationDate(DateTime(date))
+            self.setModificationDate(date)
         else:
             pass                        # XXX Sigh - not with