diff options
author | Adam Groszer <agroszer@gmail.com> | 2013-11-25 14:27:19 +0100 |
---|---|---|
committer | Adam Groszer <agroszer@gmail.com> | 2013-11-25 14:27:19 +0100 |
commit | 902929fd0f90e7b4df0c985a2331ac9ca46d22ca (patch) | |
tree | fb8f5106d6b481b35b1226f106e5cbc16298c9c8 /src | |
parent | 9d27ea0655657ccd16278dc1d7ceaeb717b7d357 (diff) | |
download | zope-publisher-902929fd0f90e7b4df0c985a2331ac9ca46d22ca.tar.gz |
Added ``trusted`` support for ``Redirect`` exception
Diffstat (limited to 'src')
-rw-r--r-- | src/zope/publisher/http.py | 2 | ||||
-rw-r--r-- | src/zope/publisher/interfaces/__init__.py | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/zope/publisher/http.py b/src/zope/publisher/http.py index 12bceaf..fbac2da 100644 --- a/src/zope/publisher/http.py +++ b/src/zope/publisher/http.py @@ -916,7 +916,7 @@ class HTTPResponse(BaseResponse): t, v = exc_info[:2] if isinstance(t, CLASS_TYPES): if issubclass(t, Redirect): - self.redirect(v.getLocation()) + self.redirect(v.getLocation(), trusted=v.getTrusted()) return title = tname = t.__name__ else: diff --git a/src/zope/publisher/interfaces/__init__.py b/src/zope/publisher/interfaces/__init__.py index febc71e..ef5c3db 100644 --- a/src/zope/publisher/interfaces/__init__.py +++ b/src/zope/publisher/interfaces/__init__.py @@ -111,15 +111,22 @@ class IRedirect(IPublishingException): def getLocation(): 'Returns the location.' + def getTrusted(): + 'Returns the trusted value.' + @implementer(IRedirect) class Redirect(PublishingException): - def __init__(self, location): + def __init__(self, location, trusted=False): self.location = location + self.trusted = trusted def getLocation(self): return self.location + def getTrusted(self): + return self.trusted + def __str__(self): return 'Location: %s' % self.location @@ -478,7 +485,7 @@ class IStartRequestEvent(IRequestEvent): class RequestEvent(object): """Events for requests. - + :ivar request: The request the event is for. """ @@ -506,7 +513,7 @@ class ISkinType(IInterface): class ISkinnable(Interface): """A skinnable (request) can provide a skin. - + The implementation in BrowserRequest will apply a default skin/layer called ``IDefaultBrowserLayer`` if not default skin get registered. """ |