Skip to content
Myr

Restored 2.5 compatibility and actual fix for the json problem

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 80eb6cf · Browse files · 4 files+9 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+9 added−4 removed

  • other:+9 added−4 removed

4 files+9 added−4 removed

modified:flask/helpers.py+5 added-1 removed
17 unmodified lines
1819# try to load the best simplejson implementation available. If JSON20# is not installed, we add a failing class.21json_available = True22json = None23try:24 import simplejson as json25except ImportError:26 try:
5 unmodified lines
3233from jinja2 import FileSystemLoader3435from .globals import session, _request_ctx_stack, current_app, request35from .wrappers import Response363738def _assert_have_json():39 """Helper function that fails if JSON is unavailable."""
323 unmodified lines
363 :param resource: the name of the resource. To access resources within364 subfolders use forward slashes as separator.365 """366 return open(os.path.join(self.root_path, resource), 'rb')367368369# circular dependencies between wrappers and helpers370from .wrappers import Response
modified:flask/module.py+1 added-1 removed
7 unmodified lines
8 :copyright: (c) 2010 by Armin Ronacher.9 :license: BSD, see LICENSE for more details.10"""1112from flask.helpers import _PackageBoundObject12from .helpers import _PackageBoundObject131415def _register_module(module, static_path):16 """Internal helper function that returns a function for recording
171 unmodified lines
modified:flask/wrappers.py+1 added-2 removed
10 unmodified lines
1112from werkzeug import Request as RequestBase, Response as ResponseBase, \13 cached_property1415from .helpers import json15from .helpers import json, _assert_have_json161718class Request(RequestBase):19 """The request object used by default in flask. Remembers the
31 unmodified lines
51 """If the mimetype is `application/json` this will contain the52 parsed JSON data.53 """54 if __debug__:55 from flask.helpers import _assert_have_json55 _assert_have_json()56 if self.mimetype == 'application/json':57 return json.loads(self.data)58
11 unmodified lines
modified:.gitignore+2 added
1.DS_Store2*.pyc3*.pyo4env5env*6dist7*.egg8*.egg-info9_mailinglist