[Zodb-checkins] CVS: Zope3/lib/python/Persistence - Module.py:1.22 IPersistentModuleManager.py:1.2

Jeremy Hylton jeremy@zope.com
Wed, 2 Oct 2002 17:34:22 -0400


Update of /cvs-repository/Zope3/lib/python/Persistence
In directory cvs.zope.org:/tmp/cvs-serv25720/lib/python/Persistence

Modified Files:
	Module.py IPersistentModuleManager.py 
Log Message:
Add name and module as attributes of the manager.



=== Zope3/lib/python/Persistence/Module.py 1.21 => 1.22 ===
--- Zope3/lib/python/Persistence/Module.py:1.21	Wed Oct  2 15:01:59 2002
+++ Zope3/lib/python/Persistence/Module.py	Wed Oct  2 17:34:22 2002
@@ -70,15 +70,13 @@
 
 class PersistentModuleManager(Persistent):
 
-    __implements__ = (IPersistentModuleManager,
-                      IPersistentModuleUpdateRegistry)
+    __implements__ = IPersistentModuleManager
 
     def __init__(self, registry):
         self._registry = registry
         self._module = None
-
-    def findModule(self, name):
-        return self._registry.findModule(name)
+        self.name = None
+        self.source = None
 
     def new(self, name, source):
         if self._module is not None:
@@ -93,19 +91,21 @@
         except ValueError, err:
             self._module = None
             raise
+        self.name = name
         self.update(source)
         if parent is not None:
             modname = name.split(".")[-1]
             setattr(parent, modname, self._module)
 
     def update(self, source):
+        self._module._p_changed = True
         moddict = self._module.__dict__
         copy = moddict.copy()
-        moddict[__persistent_module_registry__] = self
+        moddict[__persistent_module_registry__] = self._registry
         exec source in moddict
         del moddict[__persistent_module_registry__]
         self._fixup(moddict, copy, self._module)
-        self._module._p_changed = True
+        self.source = source
 
     def remove(self, source):
         self._registry.delModule(self._module.__name__)


=== Zope3/lib/python/Persistence/IPersistentModuleManager.py 1.1 => 1.2 ===
--- Zope3/lib/python/Persistence/IPersistentModuleManager.py:1.1	Thu Sep 19 17:37:21 2002
+++ Zope3/lib/python/Persistence/IPersistentModuleManager.py	Wed Oct  2 17:34:22 2002
@@ -1,8 +1,11 @@
 try:
     from Interface import Interface
+    from Interface.Attribute import Attribute
 except ImportError:
     class Interface:
         pass
+    def Attribute(x):
+        return x
 
 class IPersistentModuleManager(Interface):
 
@@ -15,3 +18,5 @@
     def remove():
         """Unregister the module and forget about it."""
 
+    name = Attribute("Absolute module name")
+    source = Attribute("Module source string")