Skip to content

Commit 51a89bf

Browse files
committed
Restored 2.5 compatibility and actual fix for the json problem
1 parent 80eb6cf commit 51a89bf

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
*.pyc
33
*.pyo
44
env
5+
env*
56
dist
7+
*.egg
68
*.egg-info
79
_mailinglist

flask/helpers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
# try to load the best simplejson implementation available. If JSON
2020
# is not installed, we add a failing class.
2121
json_available = True
22+
json = None
2223
try:
2324
import simplejson as json
2425
except ImportError:
@@ -32,7 +33,6 @@
3233
from jinja2 import FileSystemLoader
3334

3435
from .globals import session, _request_ctx_stack, current_app, request
35-
from .wrappers import Response
3636

3737

3838
def _assert_have_json():
@@ -364,3 +364,7 @@ def open_resource(self, resource):
364364
subfolders use forward slashes as separator.
365365
"""
366366
return open(os.path.join(self.root_path, resource), 'rb')
367+
368+
369+
# circular dependencies between wrappers and helpers
370+
from .wrappers import Response

flask/module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
:license: BSD, see LICENSE for more details.
1010
"""
1111

12-
from flask.helpers import _PackageBoundObject
12+
from .helpers import _PackageBoundObject
1313

1414

1515
def _register_module(module, static_path):

flask/wrappers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from werkzeug import Request as RequestBase, Response as ResponseBase, \
1313
cached_property
1414

15-
from .helpers import json
15+
from .helpers import json, _assert_have_json
1616

1717

1818
class Request(RequestBase):
@@ -52,7 +52,6 @@ def json(self):
5252
parsed JSON data.
5353
"""
5454
if __debug__:
55-
from flask.helpers import _assert_have_json
5655
_assert_have_json()
5756
if self.mimetype == 'application/json':
5857
return json.loads(self.data)

0 commit comments

Comments
 (0)