'Issues an HTTP redirect to the given relative URL.
Args:
uri: a relative or absolute URI (e.g., \'../flowers.html\')
permanent: if true, we use a 301 redirect instead of a 302 redirect'

def redirect(self, uri, permanent=False):

    if permanent:
        self.response.set_status(301)
    else:
        self.response.set_status(302)
    absolute_url = urlparse.urljoin(self.request.uri, uri)
    self.response.headers['Location'] = str(absolute_url)
    self.response.clear()
