[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/app/observable/observers.py AdapterRegistry has been refactored without this code being updated.

Philipp von Weitershausen philikon at philikon.de
Fri Sep 24 14:09:28 EDT 2004


Log message for revision 27677:
  AdapterRegistry has been refactored without this code being updated.
  A few methods and attributes of AdapterRegistry apparently were split
  off to AdapterLookup, causing not only KeyErrors on a few state dictionary
  accesses, but also pickling errors on methods that are dynamically bound
  to the registry in __init__.
  


Changed:
  U   Zope3/branches/ZopeX3-3.0/src/zope/app/observable/observers.py


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/observable/observers.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/observable/observers.py	2004-09-24 18:06:13 UTC (rev 27676)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/observable/observers.py	2004-09-24 18:09:28 UTC (rev 27677)
@@ -121,7 +121,7 @@
     """
 
     def __init__(self, spec, registry):
-        Surrogate.__init__(self, spec, registry)
+        super(LocalSurrogate, self).__init__(spec, registry)
         self.registry = registry
 
     def clean(self):
@@ -135,26 +135,32 @@
                 )
         else:
             self.adapters = {}
+        super(LocalSurrogate, self).clean()
 
-        Surrogate.clean(self)
-
 class Observers(AdapterRegistry, Persistent):
     """Local/persistent surrogate registry
     """
-
     
     _surrogateClass = LocalSurrogate
 
     def __init__(self):
         self.adapters = {}
-        AdapterRegistry.__init__(self)
+        super(Observers, self).__init__()
 
     def __getstate__(self):
         state = Persistent.__getstate__(self).copy()
-        del state['_surrogates']
+
+        # set by AdapterRegistry.__init__
         del state['_default']
         del state['_null']
-        del state['_remove']
+
+        # the following attributes are instance methods that
+        # AdapterRegistry.__init__ took from its AdapterLookup
+        # instance
+        for key in ('lookup', 'lookup1', 'queryAdapter', 'get',
+                    'adapter_hook', 'subscriptions',
+                    'queryMultiAdapter', 'subscribers'):
+            del state[key]
         return state
 
     def __setstate__(self, state):



More information about the Zope3-Checkins mailing list