diff --git a/.gitignore b/.gitignore index 148e5029..4844be8e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ *.pyc *.pyo env +env* dist +*.egg *.egg-info _mailinglist diff --git a/flask/helpers.py b/flask/helpers.py index 2303b58d..dcf25baf 100644 --- a/flask/helpers.py +++ b/flask/helpers.py @@ -19,6 +19,7 @@ from zlib import adler32 # try to load the best simplejson implementation available. If JSON # is not installed, we add a failing class. json_available = True +json = None try: import simplejson as json except ImportError: @@ -32,7 +33,6 @@ from werkzeug import Headers, wrap_file, is_resource_modified, cached_property from jinja2 import FileSystemLoader from .globals import session, _request_ctx_stack, current_app, request -from .wrappers import Response def _assert_have_json(): @@ -364,3 +364,7 @@ class _PackageBoundObject(object): subfolders use forward slashes as separator. """ return open(os.path.join(self.root_path, resource), 'rb') + + +# circular dependencies between wrappers and helpers +from .wrappers import Response diff --git a/flask/module.py b/flask/module.py index d106e69b..dfd30675 100644 --- a/flask/module.py +++ b/flask/module.py @@ -9,7 +9,7 @@ :license: BSD, see LICENSE for more details. """ -from flask.helpers import _PackageBoundObject +from .helpers import _PackageBoundObject def _register_module(module, static_path): diff --git a/flask/wrappers.py b/flask/wrappers.py index 7605ea13..1dcf23d1 100644 --- a/flask/wrappers.py +++ b/flask/wrappers.py @@ -12,7 +12,7 @@ from werkzeug import Request as RequestBase, Response as ResponseBase, \ cached_property -from .helpers import json +from .helpers import json, _assert_have_json class Request(RequestBase): @@ -52,7 +52,6 @@ class Request(RequestBase): parsed JSON data. """ if __debug__: - from flask.helpers import _assert_have_json _assert_have_json() if self.mimetype == 'application/json': return json.loads(self.data)