[Zope-Checkins] CVS: Zope3/lib/python/Persistence - Module.py:1.7
Tim Peters
tim.one@comcast.net
Thu, 27 Jun 2002 01:30:32 -0400
Update of /cvs-repository/Zope3/lib/python/Persistence
In directory cvs.zope.org:/tmp/cvs-serv1143
Modified Files:
Module.py
Log Message:
module_from_file(): Open text files in text mode. This cures a test
failure on Windows, and shouldn't make any difference on Linux.
=== Zope3/lib/python/Persistence/Module.py 1.6 => 1.7 ===
def module_from_file(self, name, path):
assert not self.modules.has_key(name)
- f = open(path, "rb")
+ f = open(path)
src = f.read()
f.close()
self.module_from_source(name, src)
@@ -97,7 +97,7 @@
copy = m.__dict__.copy()
exec source in m.__dict__
self.fixup(m.__dict__, copy, m)
-
+
def fixup(self, new, old, module):
# Update persistent objects in place, and
# convert new functions to persistent functions
@@ -106,7 +106,7 @@
for k, v in new.items():
if isinstance(v, function):
v = new[k] = PersistentFunction(v, module)
-
+
old_v = old.get(k)
if old_v is not None:
# XXX the type test below works for functions, but may