Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added config option for disabling setupmethod (first request check) d…

…ecorator.
  • Loading branch information...
commit c557ba13fdbef39e075b349cb10f3f52916f9c07 1 parent 49b77fb
@mfa authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 flask/app.py
View
9 flask/app.py
@@ -50,9 +50,13 @@ def _make_timedelta(value):
def setupmethod(f):
"""Wraps a method so that it performs a check in debug mode if the
first request was already handled.
+
+ Disable this decorator by set ``ENABLE_GOT_FIRST_REQUEST_ASSERTION`` to
+ True.
"""
def wrapper_func(self, *args, **kwargs):
- if self.debug and self._got_first_request:
+ if self.debug and self._got_first_request and \
+ self.config.get('ENABLE_GOT_FIRST_REQUEST_ASSERTION', True):
raise AssertionError('A setup function was called after the '
'first request was handled. This usually indicates a bug '
'in the application where a module was not imported '
@@ -250,7 +254,8 @@ class Flask(_PackageBoundObject):
'SESSION_COOKIE_SECURE': False,
'MAX_CONTENT_LENGTH': None,
'TRAP_BAD_REQUEST_ERRORS': False,
- 'TRAP_HTTP_EXCEPTIONS': False
+ 'TRAP_HTTP_EXCEPTIONS': False,
+ 'ENABLE_GOT_FIRST_REQUEST_ASSERTION': True
})
#: The rule object to use for URL rules created. This is used by

0 comments on commit c557ba1

Please sign in to comment.
Something went wrong with that request. Please try again.