Browse Source

Switch to explicit Werkzeug imports

pull/280/merge
Armin Ronacher 14 years ago
parent
commit
2866ccda1f
  1. 3
      flask/__init__.py
  2. 6
      flask/app.py
  3. 2
      flask/config.py
  4. 2
      flask/globals.py
  5. 8
      flask/helpers.py
  6. 2
      flask/testing.py
  7. 4
      flask/wrappers.py

3
flask/__init__.py

@ -14,7 +14,8 @@ __version__ = '0.8-dev'
# utilities we import from Werkzeug and Jinja2 that are unused # utilities we import from Werkzeug and Jinja2 that are unused
# in the module but are exported as public interface. # in the module but are exported as public interface.
from werkzeug import abort, redirect from werkzeug.exceptions import abort
from werkzeug.utils import redirect
from jinja2 import Markup, escape from jinja2 import Markup, escape
from .app import Flask, Request, Response from .app import Flask, Request, Response

6
flask/app.py

@ -16,7 +16,7 @@ from threading import Lock
from datetime import timedelta from datetime import timedelta
from itertools import chain from itertools import chain
from werkzeug import ImmutableDict from werkzeug.datastructures import ImmutableDict
from werkzeug.routing import Map, Rule from werkzeug.routing import Map, Rule
from werkzeug.exceptions import HTTPException, InternalServerError, \ from werkzeug.exceptions import HTTPException, InternalServerError, \
MethodNotAllowed MethodNotAllowed
@ -551,7 +551,7 @@ class Flask(_PackageBoundObject):
Werkzeug server. See :func:`werkzeug.run_simple` Werkzeug server. See :func:`werkzeug.run_simple`
for more information. for more information.
""" """
from werkzeug import run_simple from werkzeug.serving import run_simple
if 'debug' in options: if 'debug' in options:
self.debug = options.pop('debug') self.debug = options.pop('debug')
options.setdefault('use_reloader', self.debug) options.setdefault('use_reloader', self.debug)
@ -1267,7 +1267,7 @@ class Flask(_PackageBoundObject):
:func:`werkzeug.create_environ` for more information, this :func:`werkzeug.create_environ` for more information, this
function accepts the same arguments). function accepts the same arguments).
""" """
from werkzeug import create_environ from werkzeug.test import create_environ
environ_overrides = kwargs.setdefault('environ_overrides', {}) environ_overrides = kwargs.setdefault('environ_overrides', {})
if self.config.get('SERVER_NAME'): if self.config.get('SERVER_NAME'):
server_name = self.config.get('SERVER_NAME') server_name = self.config.get('SERVER_NAME')

2
flask/config.py

@ -15,7 +15,7 @@ import imp
import os import os
import errno import errno
from werkzeug import import_string from werkzeug.utils import import_string
class ConfigAttribute(object): class ConfigAttribute(object):

2
flask/globals.py

@ -11,7 +11,7 @@
""" """
from functools import partial from functools import partial
from werkzeug import LocalStack, LocalProxy from werkzeug.local import LocalStack, LocalProxy
def _lookup_object(name): def _lookup_object(name):
top = _request_ctx_stack.top top = _request_ctx_stack.top

8
flask/helpers.py

@ -36,9 +36,15 @@ except ImportError:
json_available = False json_available = False
from werkzeug import Headers, wrap_file from werkzeug.datastructures import Headers
from werkzeug.exceptions import NotFound from werkzeug.exceptions import NotFound
# this was moved in 0.7
try:
from werkzeug.wsgi import wrap_file
except ImportError:
from werkzeug.utils import wrap_file
from jinja2 import FileSystemLoader from jinja2 import FileSystemLoader
from .globals import session, _request_ctx_stack, current_app, request from .globals import session, _request_ctx_stack, current_app, request

2
flask/testing.py

@ -10,7 +10,7 @@
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from werkzeug import Client, EnvironBuilder from werkzeug.test import Client, EnvironBuilder
from flask import _request_ctx_stack from flask import _request_ctx_stack

4
flask/wrappers.py

@ -9,8 +9,8 @@
:license: BSD, see LICENSE for more details. :license: BSD, see LICENSE for more details.
""" """
from werkzeug import Request as RequestBase, Response as ResponseBase, \ from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase
cached_property from werkzeug.utils import cached_property
from .helpers import json, _assert_have_json from .helpers import json, _assert_have_json
from .globals import _request_ctx_stack from .globals import _request_ctx_stack

Loading…
Cancel
Save