Skip to content
Myr

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

2 files+17 added−32 removed

modified:docs/api.rst+6 added-17 removed
25 unmodified lines
26Incoming Request Data27---------------------2829.. autoclass:: Request30 :members:31 :inherited-members:32 :exclude-members: json_module30 :members:31 :inherited-members:32 :exclude-members: json_module3334.. attribute:: request3536 To access incoming request data, you can use the global `request`
10 unmodified lines
47Response Objects48----------------4950.. autoclass:: flask.Response51 :members: set_cookie, max_cookie_size, data, mimetype, is_json, get_json51 :members:52 :inherited-members:53 :exclude-members: json_module5453 .. attribute:: headers5455 A :class:`~werkzeug.datastructures.Headers` object representing the response headers.5657 .. attribute:: status5859 A string with a response status.6061 .. attribute:: status_code6263 The response status as integer.646555Sessions56--------5758If you have set :attr:`Flask.secret_key` (or configured it from
702 unmodified lines
modified:src/flask/wrappers.py+11 added-15 removed
1from werkzeug.exceptions import BadRequest2from werkzeug.wrappers import Request as RequestBase3from werkzeug.wrappers import Response as ResponseBase4from werkzeug.wrappers.json import JSONMixin as _JSONMixin45from . import json6from .globals import current_app7810class JSONMixin(_JSONMixin):11 json_module = json1213 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}")1617 raise BadRequest()181920class Request(RequestBase, JSONMixin):9class Request(RequestBase):10 """The request object used by default in Flask. Remembers the11 matched endpoint and view arguments.1213 It is what ends up as :class:`~flask.request`. If you want to replace
4 unmodified lines
18 provides all of the attributes Werkzeug defines plus a few Flask19 specific ones.20 """2122 json_module = json2324 #: 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 lines
79 from .debughelpers import attach_enctype_error_multidict8081 attach_enctype_error_multidict(self)8283 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}")8687 raise BadRequest()888993class Response(JSONMixin, ResponseBase):90class 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 lines
106 """107108 default_mimetype = "text/html"109113 def _get_data_for_json(self, cache):114 return self.get_data()110 json_module = json111112 @property113 def max_cookie_size(self):114 """Read-only view of the :data:`MAX_COOKIE_SIZE` config key.
9 unmodified lines