remove JSONMixin
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parent d887d32 · Browse files · 2 files·+17 added−32 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+17 added−32 removed
- other:+17 added−32 removed
Provenance
- Commit
fdba0d2- Tree
a45b8f0- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
d887d32
2 files changed+17 added−32 removed
modified:docs/api.rst+6 added-17 removed
25 unmodified lines26 Incoming Request Data27 ---------------------28 29 .. autoclass:: Request30- :members:31- :inherited-members:32- :exclude-members: json_module30+ :members:31+ :inherited-members:32+ :exclude-members: json_module33 34 .. attribute:: request35 36 To access incoming request data, you can use the global `request`10 unmodified lines47 Response Objects48 ----------------49 50 .. autoclass:: flask.Response51- :members: set_cookie, max_cookie_size, data, mimetype, is_json, get_json51+ :members:52+ :inherited-members:53+ :exclude-members: json_module54 53- .. attribute:: headers54-55- A :class:`~werkzeug.datastructures.Headers` object representing the response headers.56-57- .. attribute:: status58-59- A string with a response status.60-61- .. attribute:: status_code62-63- The response status as integer.64-65-55 Sessions56 --------57 58 If you have set :attr:`Flask.secret_key` (or configured it from702 unmodified linesmodified:src/flask/wrappers.py+11 added-15 removed
1 from werkzeug.exceptions import BadRequest2 from werkzeug.wrappers import Request as RequestBase3 from werkzeug.wrappers import Response as ResponseBase4-from werkzeug.wrappers.json import JSONMixin as _JSONMixin4 5 from . import json6 from .globals import current_app7 8 10-class JSONMixin(_JSONMixin):11- json_module = json12-13- def on_json_loading_failed(self, e):14- if current_app and current_app.debug:15- raise BadRequest(f"Failed to decode JSON object: {e}")16-17- raise BadRequest()18-19-20-class Request(RequestBase, JSONMixin):9+class Request(RequestBase):10 """The request object used by default in Flask. Remembers the11 matched endpoint and view arguments.12 13 It is what ends up as :class:`~flask.request`. If you want to replace4 unmodified lines18 provides all of the attributes Werkzeug defines plus a few Flask19 specific ones.20 """21 22+ json_module = json23+24 #: The internal URL rule that matched the request. This can be25 #: useful to inspect which methods are allowed for the URL from26 #: a before/after handler (``request.url_rule.methods``) etc.27 #: Though if the request's method was invalid for the URL rule,51 unmodified lines79 from .debughelpers import attach_enctype_error_multidict80 81 attach_enctype_error_multidict(self)82 83+ def on_json_loading_failed(self, e):84+ if current_app and current_app.debug:85+ raise BadRequest(f"Failed to decode JSON object: {e}")86 87+ raise BadRequest()88+89+93-class Response(JSONMixin, ResponseBase):90+class Response(ResponseBase):91 """The response object that is used by default in Flask. Works like the92 response object from Werkzeug but is set to have an HTML mimetype by93 default. Quite often you don't have to create this object yourself because94 :meth:`~flask.Flask.make_response` will take care of that for you.11 unmodified lines106 """107 108 default_mimetype = "text/html"109 113- def _get_data_for_json(self, cache):114- return self.get_data()110+ json_module = json111 112 @property113 def max_cookie_size(self):114 """Read-only view of the :data:`MAX_COOKIE_SIZE` config key.9 unmodified lines