[Zope-Checkins] CVS: Packages/ZopeUndo - Prefix.py:1.1.66.2

Tim Peters tim.one at comcast.net
Wed Apr 27 14:58:15 EDT 2005


Update of /cvs-repository/Packages/ZopeUndo
In directory cvs.zope.org:/tmp/cvs-serv17930/ZopeUndo

Modified Files:
      Tag: Zope-2_7-branch
	Prefix.py 
Log Message:
Turns out the change snuck into ZopeUndo.Prefix created critical
ZEO compatibility bugs.  This will force a ZODB 3.2.8 release.  Good
thing Andreas didn't release Zope 2.7.6 yet!


=== Packages/ZopeUndo/Prefix.py 1.1.66.1 => 1.1.66.2 ===
--- Packages/ZopeUndo/Prefix.py:1.1.66.1	Wed Mar 30 02:47:42 2005
+++ Packages/ZopeUndo/Prefix.py	Wed Apr 27 14:57:45 2005
@@ -36,12 +36,28 @@
         path_list = path.split('/')
         self.length = len(path_list)
         self.path = path_list
+        # In case we ship this to a pre-3.2.7 ZEO server, which expects
+        # to see .value but nothing else.
+        self.value = len(path), path
+
+    # Prior to ZODB 3.2.7, this only had a .value attribute, containing
+    # tuple (len(path), path) where path is a string.  So if a pre-3.2.7
+    # ZEO client ships one of these to a 3.2.7+ ZEO server, .value is
+    # all that exists.  In 3.2.7, fixme() didn't exist, and the ZEO server
+    # dies trying to reference non-existent attributes.  After 3.2.7,
+    # we create the new attributes here.
+    def fixme(self):
+        if not hasattr(self, 'path'):
+            dummy, path = self.value
+            self.__init__(path)
 
     def __cmp__(self, o):
+        self.fixme()
         other_path = o.split('/')
         return cmp(other_path[:self.length], self.path)
 
     def __repr__(self):
+        self.fixme()
         # makes failing tests easier to read
         return "Prefix('%s')" % '/'.join(self.path)
 



More information about the Zope-Checkins mailing list