[Zodb-checkins] CVS: Zope3/src/zodb/code - module.py:1.16.2.1
Fred L. Drake, Jr.
fred at zope.com
Sat Jun 28 11:44:33 EDT 2003
Update of /cvs-repository/Zope3/src/zodb/code
In directory cvs.zope.org:/tmp/cvs-serv6318/src/zodb/code
Modified Files:
Tag: fdrake-local-modules-branch
module.py
Log Message:
Checkpoint: changes to local modules started with Jim on Thursday.
These are not yet ready to land on the trunk.
=== Zope3/src/zodb/code/module.py 1.16 => 1.16.2.1 ===
--- Zope3/src/zodb/code/module.py:1.16 Fri Jun 27 13:19:03 2003
+++ Zope3/src/zodb/code/module.py Sat Jun 28 10:44:02 2003
@@ -101,6 +101,24 @@
mgr.new(name, source)
return mgr
+
+def compileModule(module, registry, source):
+ # Try to prevent compilation errors from files without trailing
+ # newlines.
+ if source and source[-1] != "\n":
+ source += "\n"
+ module._p_changed = True
+ moddict = module.__dict__
+ old_names = NameFinder(module)
+ moddict[__persistent_module_registry__] = registry
+ # XXX need to be able to replace sys.std{in,out,err} at this point
+ exec source in moddict
+ # XXX and restore them here.
+ del moddict[__persistent_module_registry__]
+ new_names = NameFinder(module)
+ replacements = new_names.replacements(old_names)
+ convert(module, replacements)
+
class PersistentModuleManager(Persistent):
implements(IPersistentModuleManager)
@@ -138,17 +156,7 @@
def update(self, source):
# Try to prevent compilation errors from files without trailing
# newlines.
- if source and source[-1] != "\n":
- source += "\n"
- self._module._p_changed = True
- moddict = self._module.__dict__
- old_names = NameFinder(self._module)
- moddict[__persistent_module_registry__] = self._registry
- exec source in moddict
- del moddict[__persistent_module_registry__]
- new_names = NameFinder(self._module)
- replacements = new_names.replacements(old_names)
- convert(self._module, replacements)
+ compileModule(self._module, self._registry, source)
self.source = source
def remove(self):
More information about the Zodb-checkins
mailing list