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

Ken Manheimer klm@zope.com
Thu, 3 Oct 2002 12:32:19 -0400


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

Modified Files:
	CollectorIssue.py 
Log Message:
Fixed my modification-time provisions to work with 1.2 and earlier, as
well 1.3.  And i now see why i didn't "properly" use .notifyModified()
and .setModificationDate() - they don't exist in CMF 1.2 or earlier.
bobobase_modification_time was used there, so my code now uses the
right thing, depending on what's available.

(Except, i don't know whether or how we should set
bobobase_modification_time, so trying to initialize a collector issue
with a different mod time is a noop when using with pre-1.3 CMF.)


=== CMF/CMFCollector/CollectorIssue.py 1.46 => 1.47 ===
--- CMF/CMFCollector/CollectorIssue.py:1.46	Wed Oct  2 13:57:13 2002
+++ CMF/CMFCollector/CollectorIssue.py	Thu Oct  3 12:32:18 2002
@@ -155,7 +155,7 @@
                                        expiration_date=expiration_date)
 
         if modification_date:
-            self.setModificationDate(DateTime(modification_date))
+            self._setModificationDate(DateTime(modification_date))
 
     def _set_submitter_specs(self, submitter_id,
                              submitter_name, submitter_email):
@@ -300,7 +300,7 @@
             transcript.edit(self.TRANSCRIPT_FORMAT,
                             transcript.EditableBody())            
 
-        self.notifyModified()
+        self._notifyModified()
         self.reindexObject()
         self._send_update_notice('Edit', username)
 
@@ -377,7 +377,7 @@
                             or '')
                          + transcript.EditableBody())
 
-        self.notifyModified()
+        self._notifyModified()
         self.reindexObject()
         got = self._send_update_notice(action, username,
                                        orig_status, additions, removals,
@@ -727,6 +727,24 @@
                 self.classification,
                 self.importance,
                 )
+
+    def _setModificationDate(self, date):
+        # Recent versions of CMF (1.3, maybe earlier) DefaultDublinCoreImpl
+        # have .setModificationDate(), older use bobobase_modification_time,
+        # 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 hasattr(self, 'setModificationDate'):
+            self.setModificationDate(DateTime(date))
+        else:
+            pass                        # XXX Sigh - not with
+
+    def _notifyModified(self):
+        # Recent versions of CMF (1.3, maybe earlier) DefaultDublinCoreImpl
+        # have .notifyCreated(), older use bobobase_modification_time,
+        # which automatically tracks.
+        if hasattr(self, 'notifyModified'):
+            self.notifyModified()
 
     def __len__(self):
         """Number of uploaded artifacts (ie, excluding transcript)."""