我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用werkzeug.wsgi.get_current_url()。
def extract_wsgi(self, environ, headers): """Extract the server's set-cookie headers as cookies into the cookie jar. """ self.extract_cookies( _TestCookieResponse(headers), U2Request(get_current_url(environ)), )
def test_get_current_url_unicode(self): env = create_environ() env['QUERY_STRING'] = 'foo=bar&baz=blah&meh=\xcf' rv = wsgi.get_current_url(env) self.assert_strict_equal(rv, u'http://localhost/?foo=bar&baz=blah&meh=\ufffd')
def match(self, environ): url = get_current_url(environ) return bool(self._match_url(url))
def execute(self, environ, start_response): url = get_current_url(environ) if self._redirect: groups = self._match_url(url).groups() parts = urlparse(url) new_parts = urlparse(self._redirect.format(*groups)) response = redirect(urlunparse(new_parts[:2] + parts[2:])) return response(environ, start_response)