in with the new. i have the bits in places where i think they should be, now i just need to work on the import scheme layout
This commit is contained in:
parent
ee16a68bbd
commit
d0dc89ea80
8 changed files with 1574 additions and 0 deletions
57
flask/wrappers.py
Normal file
57
flask/wrappers.py
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
class Request(RequestBase):
|
||||
"""The request object used by default in flask. Remembers the
|
||||
matched endpoint and view arguments.
|
||||
|
||||
It is what ends up as :class:`~flask.request`. If you want to replace
|
||||
the request object used you can subclass this and set
|
||||
:attr:`~flask.Flask.request_class` to your subclass.
|
||||
"""
|
||||
|
||||
#: the endpoint that matched the request. This in combination with
|
||||
#: :attr:`view_args` can be used to reconstruct the same or a
|
||||
#: modified URL. If an exception happened when matching, this will
|
||||
#: be `None`.
|
||||
endpoint = None
|
||||
|
||||
#: a dict of view arguments that matched the request. If an exception
|
||||
#: happened when matching, this will be `None`.
|
||||
view_args = None
|
||||
|
||||
#: if matching the URL failed, this is the exception that will be
|
||||
#: raised / was raised as part of the request handling. This is
|
||||
#: usually a :exc:`~werkzeug.exceptions.NotFound` exception or
|
||||
#: something similar.
|
||||
routing_exception = None
|
||||
|
||||
@property
|
||||
def module(self):
|
||||
"""The name of the current module"""
|
||||
if self.endpoint and '.' in self.endpoint:
|
||||
return self.endpoint.rsplit('.', 1)[0]
|
||||
|
||||
@cached_property
|
||||
def json(self):
|
||||
"""If the mimetype is `application/json` this will contain the
|
||||
parsed JSON data.
|
||||
"""
|
||||
if __debug__:
|
||||
_assert_have_json()
|
||||
if self.mimetype == 'application/json':
|
||||
return json.loads(self.data)
|
||||
|
||||
|
||||
class Response(ResponseBase):
|
||||
"""The response object that is used by default in flask. Works like the
|
||||
response object from Werkzeug but is set to have a HTML mimetype by
|
||||
default. Quite often you don't have to create this object yourself because
|
||||
:meth:`~flask.Flask.make_response` will take care of that for you.
|
||||
|
||||
If you want to replace the response object used you can subclass this and
|
||||
set :attr:`~flask.Flask.response_class` to your subclass.
|
||||
"""
|
||||
default_mimetype = 'text/html'
|
||||
|
||||
|
||||
class _RequestGlobals(object):
|
||||
pass
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue