[Checkins] SVN: grok/branches/ulif-paster-loginhtml/src/grok/publication.py Add adapter to avoid reraising of Unauthorized in publisher.
Uli Fouquet
uli at gnufix.de
Sun Jul 12 11:37:50 EDT 2009
Log message for revision 101837:
Add adapter to avoid reraising of Unauthorized in publisher.
Changed:
U grok/branches/ulif-paster-loginhtml/src/grok/publication.py
-=-
Modified: grok/branches/ulif-paster-loginhtml/src/grok/publication.py
===================================================================
--- grok/branches/ulif-paster-loginhtml/src/grok/publication.py 2009-07-12 15:36:53 UTC (rev 101836)
+++ grok/branches/ulif-paster-loginhtml/src/grok/publication.py 2009-07-12 15:37:49 UTC (rev 101837)
@@ -176,3 +176,20 @@
def __call__(self):
request, publication = super(GrokHTTPFactory, self).__call__()
return request, GrokHTTPPublication
+
+def DontReRaiseUnauthorizedAdapter(context):
+ """Adapter to indicate we don't want Unauthorized to be reraised.
+
+ When running the publisher in ``handle_errors=False``-mode, which
+ happens for instance when running Grok in a WSGI pipeline with a
+ debugger middleware enabled, we don't want IUnauthorized errors to
+ be reraised during publishing.
+
+ We can indicate this by providing an adapter, that adapts
+ exceptions of this type (`IUnauthorized`) to
+ `zope.publisher.interfaces.IReRaiseException` and returning
+ ``False`` when being called.
+ """
+ def shouldBeReRaised():
+ return False
+ return shouldBeReRaised
More information about the Checkins
mailing list