Uploaded image for project: 'Apache AWF'
  1. Apache AWF
  2. AWF-179

Add redirect method to HttpResponse

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Labels:
      None

      Description

      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)

      1. Remove whitespace
        url = re.sub(r"[\x00-\x20]+", "", _utf8(url))
        self.set_header("Location", urlparse.urljoin(self.request.uri, url))
        self.finish()

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              niklas Niklas Gustavsson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: