[Zope-CVS] CVS: Products/BTreeFolder2 - BTreeFolder2.py:1.25

Shane Hathaway shane at zope.com
Tue Mar 16 23:05:43 EST 2004


Update of /cvs-repository/Products/BTreeFolder2
In directory cvs.zope.org:/tmp/cvs-serv20280

Modified Files:
	BTreeFolder2.py 
Log Message:
Minor changes to make compatible with Ape.

- Ape needs to initialize the data structures of an existing instance

- _setOb() should avoid waking up the subobject

Also touched up the style of manage_fixCount().


=== Products/BTreeFolder2/BTreeFolder2.py 1.24 => 1.25 ===
--- Products/BTreeFolder2/BTreeFolder2.py:1.24	Tue Mar 16 17:12:17 2004
+++ Products/BTreeFolder2/BTreeFolder2.py	Tue Mar 16 23:05:43 2004
@@ -94,6 +94,9 @@
     def __init__(self, id=None):
         if id is not None:
             self.id = id
+        self._initBTrees()
+
+    def _initBTrees(self):
         self._tree = OOBTree()
         self._count = Length()
         self._mt_index = OOBTree()
@@ -108,16 +111,14 @@
                 self._setOb(name, aq_base(value))
 
 
-    security.declareProtected(view_management_screens,
-        'manage_fixCount')
+    security.declareProtected(view_management_screens, 'manage_fixCount')
     def manage_fixCount(self):
         """Calls self._fixCount() and reports the result as text.
         """
         old, new = self._fixCount()
         path = '/'.join(self.getPhysicalPath())
-        if old==new:
-            return "No count mismatch detected in BTreeFolder2 at %s."\
-                % path
+        if old == new:
+            return "No count mismatch detected in BTreeFolder2 at %s." % path
         else:
             return ("Fixed count mismatch in BTreeFolder2 at %s. "
                     "Count was %d; corrected to %d" % (path, old, new))
@@ -226,7 +227,7 @@
         self._count.change(1)
         # Update the meta type index.
         mti = self._mt_index
-        meta_type = getattr(object, 'meta_type', None)
+        meta_type = getattr(object.__class__, 'meta_type', None)
         if meta_type is not None:
             ids = mti.get(meta_type, None)
             if ids is None:




More information about the Zope-CVS mailing list