def redir_host(self, host=None, path=None, status=None): if not host: host = self.app_host if not host or request.environ.get('HTTP_HOST') == host: return url = request.environ['wsgi.url_scheme'] + '://' + host if not path: path = request.environ.get('SCRIPT_NAME', '') + request.environ['PATH_INFO'] if request.query_string: path += '?' + request.query_string url += path return bottle_redirect(url, code=status)
def redirect(url): if url.startswith('/'): url = get_host() + url return bottle_redirect(url)
def redirect(self, url): if url.startswith('/'): url = self.get_host() + quote(url, safe='+ /!:%?$=&#') return bottle_redirect(url)