[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication - ZopePublication.py:1.1.2.2

Shane Hathaway shane@digicool.com
Fri, 16 Nov 2001 11:05:59 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication
In directory cvs.zope.org:/tmp/cvs-serv4421/Zope/App/ZopePublication

Modified Files:
      Tag: Zope-3x-branch
	ZopePublication.py 
Log Message:
Mainly improved exception handling


=== Zope3/lib/python/Zope/App/ZopePublication/ZopePublication.py 1.1.2.1 => 1.1.2.2 ===
     root_name = 'Application'
 
-    def __init__(self, db, ptype):
+    def __init__(self, db):
         # db is a ZODB.DB.DB object.
-        # ptype is a subinterface of IPublish.
         self.db = db
-        self.ptype = ptype
 
     def beforeTraversal(self, request):
+        # May set request.ptype.
         get_transaction().begin()
 
     def openedConnection(self, conn):
@@ -48,12 +47,12 @@
         self.openedConnection(conn)
         conn.setDebugInfo(getattr(request, 'environ', None), request.other)
 
-        v = conn.root()[self.root_name]
+        app = conn.root()[self.root_name]
 
-        if hasattr(v, '__of__'):
-            v = v.__of__(RequestContainer(request))
+        if hasattr(app, '__of__'):
+            app = app.__of__(RequestContainer(request))
 
-        return v
+        return app
 
     def invokeHooks(self, request, ob):
         # Call __before_publishing_traverse__ hooks
@@ -98,7 +97,7 @@
         traversed = request.traversed
         if traversed:
             context = traversed[-1]
-            handler = getExceptionHandler(context, t, self.ptype)
+            handler = getExceptionHandler(context, t, request.ptype)
             if handler is not None:
                 handler(request, exc_info)
                 return request.response