[Zodb-checkins] SVN: ZODB/trunk/src/ZODB/tests/PackableStorage.py Defining a multable attr in a class is insane.

Jim Fulton jim at zope.com
Thu Oct 8 17:04:31 EDT 2009


Log message for revision 104953:
  Defining a multable attr in a class is insane.
  

Changed:
  U   ZODB/trunk/src/ZODB/tests/PackableStorage.py

-=-
Modified: ZODB/trunk/src/ZODB/tests/PackableStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/tests/PackableStorage.py	2009-10-08 20:35:08 UTC (rev 104952)
+++ ZODB/trunk/src/ZODB/tests/PackableStorage.py	2009-10-08 21:04:31 UTC (rev 104953)
@@ -92,8 +92,15 @@
 class PackableStorageBase:
     # We keep a cache of object ids to instances so that the unpickler can
     # easily return any persistent object.
-    _cache = {}
 
+    @property
+    def _cache(self):
+        try:
+            return self.__cache
+        except AttributeError:
+            self.__cache = {}
+            return self.__cache
+
     def _newobj(self):
         # This is a convenience method to create a new persistent Object
         # instance.  It asks the storage for a new object id, creates the



More information about the Zodb-checkins mailing list