[Zope-Checkins] CVS: Zope/lib/python/ZPublisher - Publish.py:1.163

Fred L. Drake, Jr. fred@zope.com
Fri, 21 Mar 2003 17:00:58 -0500


Update of /cvs-repository/Zope/lib/python/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv27630

Modified Files:
	Publish.py 
Log Message:
Minor cleanup; try to reduce the amount of confusing code here.


=== Zope/lib/python/ZPublisher/Publish.py 1.162 => 1.163 ===
--- Zope/lib/python/ZPublisher/Publish.py:1.162	Fri Mar 21 16:20:10 2003
+++ Zope/lib/python/ZPublisher/Publish.py	Fri Mar 21 17:00:56 2003
@@ -163,7 +163,7 @@
             must_die=sys.exc_info()
             request.response.exception(must_die)
         except ImportError, v:
-            if type(v) is type(()) and len(v)==3: must_die=v
+            if isinstance(v, tuple) and len(v)==3: must_die=v
             elif hasattr(sys, 'exc_info'): must_die=sys.exc_info()
             else: must_die = SystemExit, v, sys.exc_info()[2]
             request.response.exception(1, v)
@@ -214,9 +214,10 @@
 
     acquire()
     tb=None
+    g = globals()
     try:
         try:
-            module=__import__(module_name, globals(), globals(), ('__doc__',))
+            module=__import__(module_name, g, g, ('__doc__',))
 
             # Let the app specify a realm
             if hasattr(module,'__bobo_realm__'):
@@ -243,12 +244,8 @@
                     debug_mode = 1
 
 
-            if hasattr(module,'__bobo_before__'):
-                bobo_before=module.__bobo_before__
-            else: bobo_before=None
-
-            if hasattr(module,'__bobo_after__'): bobo_after=module.__bobo_after__
-            else: bobo_after=None
+            bobo_before = getattr(module, "__bobo_before__", None)
+            bobo_after = getattr(module, "__bobo_after__", None)
 
             if hasattr(module,'bobo_application'):
                 object=module.bobo_application