Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 4 commits
  • 1 file changed
  • 0 comments
  • 1 contributor

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. +6 1 flask/app.py
7 flask/app.py
@@ -50,9 +50,13 @@ def _make_timedelta(value):
50 50 def setupmethod(f):
51 51 """Wraps a method so that it performs a check in debug mode if the
52 52 first request was already handled.
  53 +
  54 + Disable this decorator by set ``ENABLE_GOT_FIRST_REQUEST_ASSERTION`` to
  55 + False (default is True).
53 56 """
54 57 def wrapper_func(self, *args, **kwargs):
55   - if self.debug and self._got_first_request:
  58 + if self.debug and self._got_first_request and \
  59 + self.config.get('ENABLE_GOT_FIRST_REQUEST_ASSERTION', True):
56 60 raise AssertionError('A setup function was called after the '
57 61 'first request was handled. This usually indicates a bug '
58 62 'in the application where a module was not imported '
@@ -264,6 +268,7 @@ class Flask(_PackageBoundObject):
264 268 'SEND_FILE_MAX_AGE_DEFAULT': 12 * 60 * 60, # 12 hours
265 269 'TRAP_BAD_REQUEST_ERRORS': False,
266 270 'TRAP_HTTP_EXCEPTIONS': False,
  271 + 'ENABLE_GOT_FIRST_REQUEST_ASSERTION': True,
267 272 'PREFERRED_URL_SCHEME': 'http'
268 273 })
269 274

No commit comments for this range

Something went wrong with that request. Please try again.