Fixed various issues on the Python 3 port
This commit is contained in:
parent
8aaf302586
commit
abc1505196
3 changed files with 36 additions and 10 deletions
|
|
@ -13,7 +13,11 @@
|
|||
from contextlib import contextmanager
|
||||
from werkzeug.test import Client, EnvironBuilder
|
||||
from flask import _request_ctx_stack
|
||||
from ._compat import urlparse
|
||||
|
||||
try:
|
||||
from werkzeug.urls import url_parse
|
||||
except ImportError:
|
||||
from urlparse import urlsplit as url_parse
|
||||
|
||||
|
||||
def make_test_environ_builder(app, path='/', base_url=None, *args, **kwargs):
|
||||
|
|
@ -21,7 +25,7 @@ def make_test_environ_builder(app, path='/', base_url=None, *args, **kwargs):
|
|||
http_host = app.config.get('SERVER_NAME')
|
||||
app_root = app.config.get('APPLICATION_ROOT')
|
||||
if base_url is None:
|
||||
url = urlparse(path)
|
||||
url = url_parse(path)
|
||||
base_url = 'http://%s/' % (url.netloc or http_host or 'localhost')
|
||||
if app_root:
|
||||
base_url += app_root.lstrip('/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue