[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/recorder/__init__.py
It's less error-prone to use instance attributes instead of
class attributes
Dmitry Vasiliev
dima at hlabs.spb.ru
Mon Mar 21 05:49:59 EST 2005
Log message for revision 29608:
It's less error-prone to use instance attributes instead of class attributes
for mutable types even for singletons.
Changed:
U Zope3/trunk/src/zope/app/recorder/__init__.py
-=-
Modified: Zope3/trunk/src/zope/app/recorder/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/recorder/__init__.py 2005-03-21 02:26:41 UTC (rev 29607)
+++ Zope3/trunk/src/zope/app/recorder/__init__.py 2005-03-21 10:49:58 UTC (rev 29608)
@@ -161,8 +161,9 @@
'add' needs extra locking.
"""
- _requests = {}
- _lock = threading.Lock()
+ def __init__(self):
+ self._requests = {}
+ self._lock = threading.Lock()
def add(self, rr):
"""Add a RecordedRequest to the list."""
@@ -212,11 +213,13 @@
the problem, or remove this class.
"""
- _ram_storage = ZODB.MappingStorage.MappingStorage()
- _ram_db = ZODB.DB(_ram_storage)
- _conns = {}
_key = 'RequestStorage'
+ def __init__(self):
+ self._ram_storage = ZODB.MappingStorage.MappingStorage()
+ self._ram_db = ZODB.DB(self._ram_storage)
+ self._conns = {}
+
def _getData(self):
"""Get the shared data container from the mapping storage."""
# This method closely mimics RAMSessionDataContainer._getData
More information about the Zope3-Checkins
mailing list