[Zope3-checkins] CVS: Zope3/src/zope/app/services -
interface.py:1.17.6.2
Jim Fulton
jim at zope.com
Sun Oct 12 16:40:42 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv8539/src/zope/app/services
Modified Files:
Tag: adaptergeddon-branch
interface.py
Log Message:
Got tests to pass on branch.
=== Zope3/src/zope/app/services/interface.py 1.17.6.1 => 1.17.6.2 ===
--- Zope3/src/zope/app/services/interface.py:1.17.6.1 Fri Oct 10 07:16:37 2003
+++ Zope3/src/zope/app/services/interface.py Sun Oct 12 16:40:11 2003
@@ -20,6 +20,7 @@
"""
from persistence import Persistent
+from persistence.dict import PersistentDict
from zodb.code.patch import registerWrapper, Wrapper
from zope.interface.interface import InterfaceClass
from zope.interface.interfaces import IInterface
@@ -36,7 +37,12 @@
from zope.app.interfaces.services.registration import IRegistrationStack
class PersistentInterfaceClass(Persistent, InterfaceClass):
- pass
+
+ def __init__(self, *args, **kw):
+ Persistent.__init__(self)
+ InterfaceClass.__init__(self, *args, **kw)
+
+ self.dependents = PersistentDict()
# PersistentInterface is equivalent to the zope.interface.Interface object
# except that it is also persistent. It is used in conjunction with
@@ -50,9 +56,18 @@
return PersistentInterfaceClass(self._obj.__name__)
+def getInterfaceStateForPersistentInterfaceCreation(iface):
+ # Need to convert the dependents weakref dict to a persistent dict
+ dict = iface.__dict__.copy()
+ dependents = PersistentDict()
+ for k, v in dict['dependents'].iteritems():
+ dependents[k] = v
+ dict['dependents'] = dependents
+ return dict
+
registerWrapper(InterfaceClass, PersistentInterfaceWrapper,
lambda iface: (),
- lambda iface: iface.__dict__,
+ getInterfaceStateForPersistentInterfaceCreation,
)
More information about the Zope3-Checkins
mailing list