[
https://issues.apache.org/jira/browse/DEFT-84?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Roger Schildmeijer updated DEFT-84:
-----------------------------------
Priority: Trivial
Issue Type: Improvement (was: Bug)
> Add redirect method to HttpResponse
> -----------------------------------
>
> Key: DEFT-84
> URL: https://issues.apache.org/jira/browse/DEFT-84
> Project: Deft
> Issue Type: Improvement
> Priority: Trivial
>
> Convenience method
> from facebook/tornado
> def redirect(self, url, permanent=False):
> """Sends a redirect to the given (optionally relative) URL."""
> if self._headers_written:
> raise Exception("Cannot redirect after headers have been written")
> self.set_status(301 if permanent else 302)
> # Remove whitespace
> url = re.sub(r"[\x00-\x20]+", "", _utf8(url))
> self.set_header("Location", urlparse.urljoin(self.request.uri, url))
> self.finish()
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira