[Checkins] SVN: zope.publisher/branches/unauth-exc-handler/src/zope/publisher/ Treat exceptions special if there is an adapter to them available.
Uli Fouquet
uli at gnufix.de
Sat Jul 4 06:28:28 EDT 2009
Log message for revision 101496:
Treat exceptions special if there is an adapter to them available.
Changed:
U zope.publisher/branches/unauth-exc-handler/src/zope/publisher/interfaces/__init__.py
U zope.publisher/branches/unauth-exc-handler/src/zope/publisher/publish.py
-=-
Modified: zope.publisher/branches/unauth-exc-handler/src/zope/publisher/interfaces/__init__.py
===================================================================
--- zope.publisher/branches/unauth-exc-handler/src/zope/publisher/interfaces/__init__.py 2009-07-04 10:23:50 UTC (rev 101495)
+++ zope.publisher/branches/unauth-exc-handler/src/zope/publisher/interfaces/__init__.py 2009-07-04 10:28:27 UTC (rev 101496)
@@ -498,3 +498,7 @@
A default view name is used to select a view when a user hasn't
specified one.
"""
+
+class IReRaiseException(Interface):
+ """An exception that should be reraised, when handled in publisher.
+ """
Modified: zope.publisher/branches/unauth-exc-handler/src/zope/publisher/publish.py
===================================================================
--- zope.publisher/branches/unauth-exc-handler/src/zope/publisher/publish.py 2009-07-04 10:23:50 UTC (rev 101495)
+++ zope.publisher/branches/unauth-exc-handler/src/zope/publisher/publish.py 2009-07-04 10:28:27 UTC (rev 101496)
@@ -20,8 +20,8 @@
import sys
from zope.publisher.interfaces import Retry
from zope.proxy import removeAllProxies
+from zope.security.interfaces import IUnauthorized
-
_marker = object() # Create a new marker object.
def unwrapMethod(obj):
@@ -138,11 +138,15 @@
publication.afterCall(request, obj)
except:
+ exc_info = sys.exc_info()
publication.handleException(
- obj, request, sys.exc_info(), True)
+ obj, request, exc_info, True)
if not handle_errors:
- raise
+ dummy, exc_value, dummy = exc_info
+ reraise = component.queryAdapter(exc_value, IReRaiseException, default=None)
+ if reraise is None or reraise():
+ raise
finally:
publication.endRequest(request, obj)
More information about the Checkins
mailing list