[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services -
error.py:1.9
Bradley Dean
bjdean at unimelb.edu.au
Mon Feb 9 03:19:44 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/browser/services
In directory cvs.zope.org:/tmp/cvs-serv21908/src/zope/app/browser/services
Modified Files:
error.py
Log Message:
If finding the absolute_url fails, redirect the browser to
the current site root error redirect instead.
=== Zope3/src/zope/app/browser/services/error.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/browser/services/error.py:1.8 Sun Feb 8 21:09:01 2004
+++ Zope3/src/zope/app/browser/services/error.py Mon Feb 9 03:19:43 2004
@@ -35,7 +35,18 @@
class ErrorRedirect(BrowserView):
def action(self):
- err = zapi.getService(self, ErrorLogging)
- url = str(zapi.getView(err, 'absolute_url', self.request))
- url = url + "/@@SelectedManagementView.html"
+
+ # Some locations (eg ++site++process) throw a TypeError exception when
+ # finding their absoluteurl, if this happens catch the error and
+ # redirect the browser to the site root "/@@errorRedirect.html"
+ # to handle redirection to the site error logger instead
+ try:
+ err = zapi.getService(self, ErrorLogging)
+ url = str(zapi.getView(err, 'absolute_url', self.request))
+ url = url + "/@@SelectedManagementView.html"
+ except TypeError:
+ siterooturl = self.request.getApplicationURL()
+ url = siterooturl + "/@@errorRedirect.html"
+
self.request.response.redirect(url)
+
More information about the Zope3-Checkins
mailing list