summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2016-01-24 00:57:42 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2016-02-02 04:22:16 +0100
commitf121193dd67f0b8dc404f0d6f1d942dff551e010 (patch)
tree9ebaac2a53e7080decabcd53ece46691e0e93f74
parent2c52dbbfecfaee3b08e87b8efc8c09f6021cd696 (diff)
downloadweb-f121193dd67f0b8dc404f0d6f1d942dff551e010.tar.gz
web-f121193dd67f0b8dc404f0d6f1d942dff551e010.tar.bz2
web-f121193dd67f0b8dc404f0d6f1d942dff551e010.zip
Drop before first request
@app.before_first_request is the same as duing it runing app creation
-rw-r--r--accounts/__init__.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/accounts/__init__.py b/accounts/__init__.py
index f5afc47..afa348b 100644
--- a/accounts/__init__.py
+++ b/accounts/__init__.py
@@ -17,10 +17,14 @@ if 'SPLINE_ACCOUNT_WEB_SETTINGS' in os.environ:
app.config.from_envvar('SPLINE_ACCOUNT_WEB_SETTINGS')
app.all_services = account.SERVICES #TODO: take that from our json file or so
-app.username_blacklist = list()
app.user_backend = get_backend(app.config['USER_BACKEND'], app)
app.mail_backend = get_backend(app.config['MAIL_BACKEND'], app)
+app.username_blacklist = list()
+if app.config.get('USERNAME_BLACKLIST_FILE'):
+ with open(app.config['USERNAME_BLACKLIST_FILE']) as f:
+ app.username_blacklist = f.read().split('\n')
+
@app.before_request
def session_permanent():
if app.config.get('PERMANENT_SESSION_LIFETIME'):
@@ -40,9 +44,3 @@ def initialize_user():
except ldap.INVALID_CREDENTIALS:
# we had crap in the session, delete it
logout_user()
-
-@app.before_first_request
-def read_blacklist():
- if app.config.get('USERNAME_BLACKLIST_FILE'):
- with open(app.config['USERNAME_BLACKLIST_FILE']) as f:
- app.username_blacklist = f.read().split('\n')