SVN: ZODB/trunk/src/ZODB/tests/PackableStorage.py Defining a multable attr in a class is insane.

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20091008210431.B9FFA9417B__24433.3812654533$1255036035$gmane$org@cvs.zope.org>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.