[Zope-Checkins] SVN: Zope/trunk/ Removed `bobobase_modification_time` from `Persistence.Persistent`, you can use `DateTime(object._p_mtime)` instead.

Hanno Schlichting hannosch at hannosch.eu
Sun Jul 3 10:19:27 EDT 2011


Log message for revision 122080:
  Removed `bobobase_modification_time` from `Persistence.Persistent`, you can use `DateTime(object._p_mtime)` instead.
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/App/PersistentExtra.py
  U   Zope/trunk/src/App/interfaces.py
  D   Zope/trunk/src/App/tests/testPersistentExtra.py
  U   Zope/trunk/src/OFS/ObjectManager.py
  U   Zope/trunk/src/OFS/SimpleItem.py
  U   Zope/trunk/src/OFS/dtml/fileEdit.dtml
  U   Zope/trunk/src/OFS/dtml/findAdv.dtml
  U   Zope/trunk/src/OFS/dtml/findResult.dtml
  U   Zope/trunk/src/OFS/dtml/imageEdit.dtml
  U   Zope/trunk/src/OFS/dtml/main.dtml
  U   Zope/trunk/src/Products/PageTemplates/www/ptEdit.zpt
  U   Zope/trunk/src/Products/Sessions/BrowserIdManager.py
  U   Zope/trunk/src/Products/Sessions/SessionDataManager.py
  U   Zope/trunk/src/Products/SiteAccess/www/manage_edit.dtml
  U   Zope/trunk/src/webdav/EtagSupport.py

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/doc/CHANGES.rst	2011-07-03 14:19:26 UTC (rev 122080)
@@ -41,6 +41,9 @@
 Restructuring
 +++++++++++++
 
+- Removed `bobobase_modification_time` from `Persistence.Persistent`, you can
+  use `DateTime(object._p_mtime)` instead.
+
 - Removed `AccessRule` and `SiteRoot` from `Products.SiteAccess`.
 
 - Removed `Products.ZReST` and the `reStructuredText` wrapper, you can use

Modified: Zope/trunk/src/App/PersistentExtra.py
===================================================================
--- Zope/trunk/src/App/PersistentExtra.py	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/App/PersistentExtra.py	2011-07-03 14:19:26 UTC (rev 122080)
@@ -10,28 +10,10 @@
 # FOR A PARTICULAR PURPOSE
 #
 ##############################################################################
-"""Patch for Persistent to support IPersistentExtra.
-"""
 
-from DateTime.DateTime import DateTime
-
-class PersistentUtil:
-
-    def bobobase_modification_time(self):
-        jar = self._p_jar
-        oid = self._p_oid
-        if jar is None or oid is None:
-            return DateTime()
-
-        try:
-            t = self._p_mtime
-        except AttributeError:
-            t = 0
-        return DateTime(t)
-
-
 _patched = False
 
+
 def patchPersistent():
     global _patched
     if _patched:
@@ -39,14 +21,6 @@
 
     _patched = True
 
-    from zope.interface import classImplements
     from Persistence import Persistent
     from AccessControl.class_init import InitializeClass
-    from App.interfaces import IPersistentExtra
     Persistent.__class_init__ = InitializeClass
-
-    for k, v in PersistentUtil.__dict__.items():
-        if k[0] != '_':
-            setattr(Persistent, k, v)
-
-    classImplements(Persistent, IPersistentExtra)

Modified: Zope/trunk/src/App/interfaces.py
===================================================================
--- Zope/trunk/src/App/interfaces.py	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/App/interfaces.py	2011-07-03 14:19:26 UTC (rev 122080)
@@ -40,16 +40,6 @@
 
 # XXX: might contain non-API methods and outdated comments;
 #      not synced with ZopeBook API Reference;
-#      based on App.PersistentExtra.PersistentUtil
-class IPersistentExtra(Interface):
-
-    def bobobase_modification_time():
-        """
-        """
-
-
-# XXX: might contain non-API methods and outdated comments;
-#      not synced with ZopeBook API Reference;
 #      based on App.Undo.UndoSupport
 class IUndoSupport(Interface):
 

Deleted: Zope/trunk/src/App/tests/testPersistentExtra.py
===================================================================
--- Zope/trunk/src/App/tests/testPersistentExtra.py	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/App/tests/testPersistentExtra.py	2011-07-03 14:19:26 UTC (rev 122080)
@@ -1,19 +0,0 @@
-import unittest
-
-
-class TestPersistent(unittest.TestCase):
-
-    def test_interfaces(self):
-        from App.interfaces import IPersistentExtra
-        from Persistence import Persistent
-        from zope.interface.verify import verifyClass
-        from App.PersistentExtra import patchPersistent
-
-        patchPersistent()
-        verifyClass(IPersistentExtra, Persistent)
-
-
-def test_suite():
-    return unittest.TestSuite((
-        unittest.makeSuite(TestPersistent),
-        ))

Modified: Zope/trunk/src/OFS/ObjectManager.py
===================================================================
--- Zope/trunk/src/OFS/ObjectManager.py	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/OFS/ObjectManager.py	2011-07-03 14:19:26 UTC (rev 122080)
@@ -22,6 +22,7 @@
 import os
 import re
 import sys
+import time
 
 from AccessControl import ClassSecurityInfo
 from AccessControl.class_init import InitializeClass
@@ -42,6 +43,7 @@
 from App.Management import Navigation
 from App.Management import Tabs
 from App.special_dtml import DTMLFile
+from DateTime import DateTime
 from Persistence import Persistent
 from webdav.Collection import Collection
 from webdav.Lockable import ResourceLockedError
@@ -740,7 +742,10 @@
                 self,
                 getRoles(self, 'manage_FTPlist', self.manage_FTPlist, ())):
                 mode=mode | 0007
-        mtime=self.bobobase_modification_time().timeTime()
+        if hasattr(aq_base(self), '_p_mtime'):
+            mtime = DateTime(self._p_mtime).timeTime()
+        else:
+            mtime = time.time()
         # get owner and group
         owner=group='Zope'
         for user, roles in self.get_local_roles():

Modified: Zope/trunk/src/OFS/SimpleItem.py
===================================================================
--- Zope/trunk/src/OFS/SimpleItem.py	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/OFS/SimpleItem.py	2011-07-03 14:19:26 UTC (rev 122080)
@@ -40,6 +40,7 @@
 from App.special_dtml import DTMLFile
 from App.Undo import UndoSupport
 from ComputedAttribute import ComputedAttribute
+from DateTime import DateTime
 from DocumentTemplate.html_quote import html_quote
 from DocumentTemplate.ustr import ustr
 from ExtensionClass import Base
@@ -316,8 +317,8 @@
         else:
             size=0
         # get modification time
-        if hasattr(aq_base(self), 'bobobase_modification_time'):
-            mtime=self.bobobase_modification_time().timeTime()
+        if hasattr(aq_base(self), '_p_mtime'):
+            mtime=DateTime(self._p_mtime).timeTime()
         else:
             mtime=time.time()
         # get owner and group

Modified: Zope/trunk/src/OFS/dtml/fileEdit.dtml
===================================================================
--- Zope/trunk/src/OFS/dtml/fileEdit.dtml	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/OFS/dtml/fileEdit.dtml	2011-07-03 14:19:26 UTC (rev 122080)
@@ -70,18 +70,6 @@
   <tr>
     <td align="left" valign="top">
     <div class="form-label">
-    Last Modified
-    </div>
-    </td>
-    <td align="left" valign="top">
-    <div class="form-text">
-    <dtml-var bobobase_modification_time fmt="%Y-%m-%d %H:%M">
-    </div>
-    </td>
-  </tr>
-  <tr>
-    <td align="left" valign="top">
-    <div class="form-label">
     File Size
     </div>
     </td>

Modified: Zope/trunk/src/OFS/dtml/findAdv.dtml
===================================================================
--- Zope/trunk/src/OFS/dtml/findAdv.dtml	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/OFS/dtml/findAdv.dtml	2011-07-03 14:19:26 UTC (rev 122080)
@@ -118,7 +118,6 @@
   <SELECT NAME="skey">
   <OPTION VALUE="meta_type">Type
   <OPTION VALUE="id">Id
-  <OPTION VALUE="bobobase_modification_time">Last Modified
   </SELECT> 
   <INPUT TYPE="checkbox" NAME="rkey" VALUE="reverse">
   <span class="form-label"> Reverse?</span>

Modified: Zope/trunk/src/OFS/dtml/findResult.dtml
===================================================================
--- Zope/trunk/src/OFS/dtml/findResult.dtml	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/OFS/dtml/findResult.dtml	2011-07-03 14:19:26 UTC (rev 122080)
@@ -225,7 +225,6 @@
   <SELECT NAME="skey">
   <OPTION VALUE="id">Id
   <OPTION VALUE="meta_type">Type
-  <OPTION VALUE="bobobase_modification_time">Last Modified
   </SELECT> 
   <span class="form-label">
   <INPUT TYPE="checkbox" NAME="rkey" VALUE="reverse"> Reverse?

Modified: Zope/trunk/src/OFS/dtml/imageEdit.dtml
===================================================================
--- Zope/trunk/src/OFS/dtml/imageEdit.dtml	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/OFS/dtml/imageEdit.dtml	2011-07-03 14:19:26 UTC (rev 122080)
@@ -55,19 +55,6 @@
 <tr>
   <td align="left" valign="top">
   <div class="form-label">
-  Last Modified
-  </div>
-  </td>
-  <td align="left" valign="top">
-  <div class="form-text">
-  <dtml-var bobobase_modification_time fmt="%Y-%m-%d %H:%M">
-  </div>
-  </td>
-</tr>
-
-<tr>
-  <td align="left" valign="top">
-  <div class="form-label">
   File Size
   </div>
   </td>

Modified: Zope/trunk/src/OFS/dtml/main.dtml
===================================================================
--- Zope/trunk/src/OFS/dtml/main.dtml	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/OFS/dtml/main.dtml	2011-07-03 14:19:26 UTC (rev 122080)
@@ -92,13 +92,6 @@
    "skey == 'get_size' or rkey == 'get_size'"
    ><strong>Size</strong><dtml-else>Size</dtml-if></a></div>
   </td>
-  <td width="19%" align="left"><div class="list-item"><a 
-   href="./manage_main?skey=bobobase_modification_time<dtml-if 
-   "skey == 'bobobase_modification_time' and not rkey"
-   >&amp;rkey=bobobase_modification_time</dtml-if>"><dtml-if 
-   "skey == 'bobobase_modification_time' or rkey == 'bobobase_modification_time'"
-   ><strong>Last Modified</strong><dtml-else>Last Modified</dtml-if></a></div>
-  </td>
   <dtml-if hasOrderSupport>
   <td width="10%" align="left"><div class="list-item"><a 
    href="./manage_main?skey=position"><dtml-if 
@@ -157,12 +150,6 @@
   </dtml-try>
   </div>
   </td>
-
-  <td>
-  <div class="list-item">
-  <dtml-var bobobase_modification_time fmt="%Y-%m-%d %H:%M">
-  </div>
-  </td>
   </dtml-with>
 
   <dtml-if hasOrderSupport>

Modified: Zope/trunk/src/Products/PageTemplates/www/ptEdit.zpt
===================================================================
--- Zope/trunk/src/Products/PageTemplates/www/ptEdit.zpt	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/Products/PageTemplates/www/ptEdit.zpt	2011-07-03 14:19:26 UTC (rev 122080)
@@ -25,14 +25,8 @@
     </td>
   </tr>
   <tr>
-    <td align="left" valign="middle">
-      <div class="form-label">Last Modified</div>
-    </td>
-    <td align="left" valign="middle">
-      <div class="form-text" 
-       tal:content="python:context.bobobase_modification_time().strftime('%Y-%m-%d %I:%M %p')">1/1/2000
-      </div>
-    </td>
+    <td align="left" valign="middle"></td>
+    <td align="left" valign="middle"></td>
     <td align="left" valign="top" colspan="2">
       <a href="source.html" tal:condition="context/html">Browse HTML source</a>
       <a href="source.xml" tal:condition="not:context/html">Browse XML source</a>

Modified: Zope/trunk/src/Products/Sessions/BrowserIdManager.py
===================================================================
--- Zope/trunk/src/Products/Sessions/BrowserIdManager.py	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/Products/Sessions/BrowserIdManager.py	2011-07-03 14:19:26 UTC (rev 122080)
@@ -86,8 +86,7 @@
 
     security = ClassSecurityInfo()
     security.declareObjectPublic()
-    ok = {'meta_type':1, 'id':1, 'title': 1, 'icon':1,
-          'bobobase_modification_time':1, 'title_or_id':1 }
+    ok = {'meta_type': 1, 'id': 1, 'title': 1, 'icon': 1, 'title_or_id': 1}
     security.setDefaultAccess(ok)
     security.setPermissionDefault(MGMT_SCREEN_PERM, ['Manager'])
     security.setPermissionDefault(ACCESS_CONTENTS_PERM,['Manager','Anonymous'])

Modified: Zope/trunk/src/Products/Sessions/SessionDataManager.py
===================================================================
--- Zope/trunk/src/Products/Sessions/SessionDataManager.py	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/Products/Sessions/SessionDataManager.py	2011-07-03 14:19:26 UTC (rev 122080)
@@ -79,8 +79,7 @@
     security = ClassSecurityInfo()
     security.declareObjectPublic()
 
-    ok = {'meta_type':1, 'id':1, 'title': 1, 'icon':1,
-          'bobobase_modification_time':1, 'title_or_id':1 }
+    ok = {'meta_type': 1, 'id': 1, 'title': 1, 'icon': 1, 'title_or_id': 1}
     security.setDefaultAccess(ok)
     security.setPermissionDefault(CHANGE_DATAMGR_PERM, ['Manager'])
     security.setPermissionDefault(MGMT_SCREEN_PERM, ['Manager'])

Modified: Zope/trunk/src/Products/SiteAccess/www/manage_edit.dtml
===================================================================
--- Zope/trunk/src/Products/SiteAccess/www/manage_edit.dtml	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/Products/SiteAccess/www/manage_edit.dtml	2011-07-03 14:19:26 UTC (rev 122080)
@@ -16,13 +16,6 @@
 
 <dtml-with keyword_args mapping>
 <tr>
-  <td align="left" valign="top" class="form-label">Last Modified</td>
-  <td align="left" valign="top" class="form-text">
-<dtml-var bobobase_modification_time fmt="%Y-%m-%d %H:%M">
-  </td>
-</tr>
-
-<tr>
   <td align="left" valign="top" colspan="2" class="form-help">
   Each line represents a path mapping for a single host 
   (<strong>host/path</strong>),

Modified: Zope/trunk/src/webdav/EtagSupport.py
===================================================================
--- Zope/trunk/src/webdav/EtagSupport.py	2011-07-03 13:57:21 UTC (rev 122079)
+++ Zope/trunk/src/webdav/EtagSupport.py	2011-07-03 14:19:26 UTC (rev 122080)
@@ -44,13 +44,13 @@
 
     def http__refreshEtag():
         """\
-        While it may make sense to use the ZODB Object Id or
-        bobobase_modification_time to generate an Etag, this could
+        While it may make sense to use the ZODB Object Id or the
+        database mtime to generate an Etag, this could
         fail on certain REQUESTS because:
 
          o The object is not stored in the ZODB, or
 
-         o A Request such as PUT changes the oid or bobobase_modification_time
+         o A Request such as PUT changes the oid or database mtime
            *AFTER* the Response has been written out, but the Etag needs
            to be updated and returned with the Response of the PUT request.
 
@@ -64,7 +64,7 @@
     function right now is to support the *Lost Updates Problem* by
     allowing Etags and If-Match headers to be checked on PUT calls to
     provide a *Seatbelt* style functionality.  The Etags is based on
-    the bobobase_modification_time, and thus is updated whenever the
+    the databaes mtime, and thus is updated whenever the
     object is updated.  If a PUT request, or other HTTP or Dav request
     comes in with an Etag different than the current one, that request
     can be rejected according to the type of header (If-Match,
@@ -130,15 +130,15 @@
             # There's no 'if-none-match' header either, so there's no
             # problem continuing with the request
             return 1
-        elif ('*' in nonelist):
+        elif ('*' in nonematch):
             # if-none-match: * means that the operation should not
             # be performed if the specified resource exists
             # (webdav.NullResource will want to do special behavior
             # here)
             raise PreconditionFailed
-        elif self.http__etag() in nonelist:
+        elif self.http__etag() in nonematch:
             # The opposite of if-match, the condition fails
             # IF the resources Etag is in the if-none-match list
             raise PreconditionFailed
-        elif self.http__etag() not in nonelist:
+        elif self.http__etag() not in nonematch:
             return 1



More information about the Zope-Checkins mailing list