[Checkins] SVN: zope.app.publication/trunk/ Introduce ZopePublication.callErrorView as a possible hook point.
Marius Gedminas
cvs-admin at zope.org
Fri Nov 23 15:09:13 UTC 2012
Log message for revision 128425:
Introduce ZopePublication.callErrorView as a possible hook point.
I've a project where I override ZopePublication.callObject and log the view
class and source location. Combined with Dozer logview middleware this makes
it trivial to find the source code responsible for rendering a particular page
-- unless that page was rendered by an error view, which doesn't go though
callObject. Hence this patch.
Changed:
U zope.app.publication/trunk/CHANGES.txt
U zope.app.publication/trunk/src/zope/app/publication/zopepublication.py
-=-
Modified: zope.app.publication/trunk/CHANGES.txt
===================================================================
--- zope.app.publication/trunk/CHANGES.txt 2012-11-21 20:33:38 UTC (rev 128424)
+++ zope.app.publication/trunk/CHANGES.txt 2012-11-23 15:09:12 UTC (rev 128425)
@@ -7,7 +7,9 @@
- Relax ZODB dependency to allow 3.10dev builds from SVN.
+- Introduce ZopePublication.callErrorView as a possible hook point.
+
3.14.0 (2012-03-09)
-------------------
Modified: zope.app.publication/trunk/src/zope/app/publication/zopepublication.py
===================================================================
--- zope.app.publication/trunk/src/zope/app/publication/zopepublication.py 2012-11-21 20:33:38 UTC (rev 128424)
+++ zope.app.publication/trunk/src/zope/app/publication/zopepublication.py 2012-11-23 15:09:12 UTC (rev 128425)
@@ -204,6 +204,12 @@
def callObject(self, request, ob):
return mapply(ob, request.getPositionalArguments(), request)
+ def callErrorView(self, request, view):
+ # We don't want to pass positional arguments. The positional
+ # arguments were meant for the published object, not an exception
+ # view.
+ return mapply(view, (), request)
+
def afterCall(self, request, ob):
txn = transaction.get()
if txn.isDoomed():
@@ -372,11 +378,7 @@
if view is not None:
try:
- # We use mapply instead of self.callObject here
- # because we don't want to pass positional
- # arguments. The positional arguments were meant
- # for the published object, not an exception view.
- body = mapply(view, (), request)
+ body = self.callErrorView(request, view)
response.setResult(body)
transaction.commit()
if (ISystemErrorView.providedBy(view)
More information about the checkins
mailing list