[Zope3-checkins] SVN: Zope3/trunk/src/zo Okay, I finally found the culprit that caused the __import__ function not

Stephan Richter srichter at cosmos.phy.tufts.edu
Sun Apr 10 09:15:31 EDT 2005


Log message for revision 29938:
  Okay, I finally found the culprit that caused the __import__ function not 
  to be restored correctly. So no, Tim is not insane. :-) 
  

Changed:
  U   Zope3/trunk/src/zodbcode/tests/test_module.py
  U   Zope3/trunk/src/zope/app/module/README.txt

-=-
Modified: Zope3/trunk/src/zodbcode/tests/test_module.py
===================================================================
--- Zope3/trunk/src/zodbcode/tests/test_module.py	2005-04-10 13:03:20 UTC (rev 29937)
+++ Zope3/trunk/src/zodbcode/tests/test_module.py	2005-04-10 13:15:31 UTC (rev 29938)
@@ -97,10 +97,10 @@
         self._pmtest = os.path.join(_dir, "_pmtest.py")
 
     def tearDown(self):
-        self.importer.uninstall()
         # just in case
         transaction.abort()
         self.db.close()
+        self.importer.uninstall()
 
     def sameModules(self, registry):
         m1 = self.registry.modules()
@@ -365,6 +365,7 @@
 
     def tearDown(self):
         transaction.abort()
+        self.close()
         self.db.close()
 
     def open(self):

Modified: Zope3/trunk/src/zope/app/module/README.txt
===================================================================
--- Zope3/trunk/src/zope/app/module/README.txt	2005-04-10 13:03:20 UTC (rev 29937)
+++ Zope3/trunk/src/zope/app/module/README.txt	2005-04-10 13:15:31 UTC (rev 29938)
@@ -133,9 +133,10 @@
 In order to use this framework in real Python code import statements, we need
 to install the importer hook, which is commonly done with an event subscriber:
 
+  >>> import __builtin__
   >>> event = object()
   >>> zope.app.module.installPersistentModuleImporter(event)
-  >>> __builtins__['__import__'] # doctest: +ELLIPSIS
+  >>> __builtin__.__import__ # doctest: +ELLIPSIS
   <bound method ZopePersistentModuleImporter.__import__ of ...>
 
 Now we can simply import the persistent module:
@@ -147,5 +148,5 @@
 Finally, we unregister the hook again:
 
   >>> zope.app.module.uninstallPersistentModuleImporter(event)
-  >>> __builtins__['__import__'] # doctest: +ELLIPSIS
-  <built-in function __import__>
+  >>> __builtin__.__import__
+  <built-in function __import__>
\ No newline at end of file



More information about the Zope3-Checkins mailing list