Added MAX_CONTENT_LENGTH config key

This commit is contained in:
Armin Ronacher 2010-07-14 10:47:57 +02:00
parent f8f8463f3a
commit b1790cca55
4 changed files with 18 additions and 1 deletions

View file

@ -193,7 +193,8 @@ class Flask(_PackageBoundObject):
'PERMANENT_SESSION_LIFETIME': timedelta(days=31),
'USE_X_SENDFILE': False,
'LOGGER_NAME': None,
'SERVER_NAME': None
'SERVER_NAME': None,
'MAX_CONTENT_LENGTH': None
})
def __init__(self, import_name, static_path=None):

View file

@ -13,6 +13,7 @@ from werkzeug import Request as RequestBase, Response as ResponseBase, \
cached_property
from .helpers import json, _assert_have_json
from .globals import _request_ctx_stack
class Request(RequestBase):
@ -41,6 +42,13 @@ class Request(RequestBase):
#: something similar.
routing_exception = None
@property
def max_content_length(self):
"""Read-only view of the `MAX_CONTENT_LENGTH` config key."""
ctx = _request_ctx_stack.top
if ctx is not None:
return ctx.app.config['MAX_CONTENT_LENGTH']
@property
def endpoint(self):
"""The endpoint that matched the request. This in combination with