Browse Source

Added TESTING flag. This fixes #58.

pull/124/head
Armin Ronacher 15 years ago
parent
commit
f5fb457657
  1. 1
      CHANGES
  2. 1
      docs/config.rst
  3. 10
      flask.py

1
CHANGES

@ -18,6 +18,7 @@ Release date to be announced, codename to be selected.
requests that do not pop the request stack for testing. requests that do not pop the request stack for testing.
- because the Python standard library caches loggers, the name of - because the Python standard library caches loggers, the name of
the logger is configurable now to better support unittests. the logger is configurable now to better support unittests.
- added `TESTING` switch that can activate unittesting helpers.
Version 0.3.1 Version 0.3.1
------------- -------------

1
docs/config.rst

@ -53,6 +53,7 @@ The following configuration values are used internally by Flask:
=============================== ========================================= =============================== =========================================
``DEBUG`` enable/disable debug mode ``DEBUG`` enable/disable debug mode
``TESTING`` enable/disable testing mode
``SECRET_KEY`` the secret key ``SECRET_KEY`` the secret key
``SESSION_COOKIE_NAME`` the name of the session cookie ``SESSION_COOKIE_NAME`` the name of the session cookie
``PERMANENT_SESSION_LIFETIME`` the lifetime of a permanent session as ``PERMANENT_SESSION_LIFETIME`` the lifetime of a permanent session as

10
flask.py

@ -810,6 +810,15 @@ class Flask(_PackageBoundObject):
#: configuration key. Defaults to `False`. #: configuration key. Defaults to `False`.
debug = ConfigAttribute('DEBUG') debug = ConfigAttribute('DEBUG')
#: The testing flask. Set this to `True` to enable the test mode of
#: Flask extensions (and in the future probably also Flask itself).
#: For example this might activate unittest helpers that have an
#: additional runtime cost which should not be enabled by default.
#:
#: This attribute can also be configured from the config with the
#: `TESTING` configuration key. Defaults to `False`.
testing = ConfigAttribute('TESTING')
#: If a secret key is set, cryptographic components can use this to #: If a secret key is set, cryptographic components can use this to
#: sign cookies and other things. Set this to a complex random value #: sign cookies and other things. Set this to a complex random value
#: when you want to use the secure cookie for instance. #: when you want to use the secure cookie for instance.
@ -870,6 +879,7 @@ class Flask(_PackageBoundObject):
#: Default configuration parameters. #: Default configuration parameters.
default_config = ImmutableDict({ default_config = ImmutableDict({
'DEBUG': False, 'DEBUG': False,
'TESTING': False,
'SECRET_KEY': None, 'SECRET_KEY': None,
'SESSION_COOKIE_NAME': 'session', 'SESSION_COOKIE_NAME': 'session',
'PERMANENT_SESSION_LIFETIME': timedelta(days=31), 'PERMANENT_SESSION_LIFETIME': timedelta(days=31),

Loading…
Cancel
Save