diff options
author | Nico von Geyso <Nico.Geyso@FU-Berlin.de> | 2012-10-29 18:36:17 +0100 |
---|---|---|
committer | Nico von Geyso <Nico.Geyso@FU-Berlin.de> | 2012-10-29 18:36:17 +0100 |
commit | 1b27fe03a87aad1ed693d6197633c7ade2e68a1f (patch) | |
tree | 774d5d69a2c10b03792d8e749548848d9508ccb2 /utils.py | |
parent | c5823c2473a5301f4799e41717a21c8d5ab56466 (diff) | |
parent | 815df16283c6332c1c4ba9d129fd745cabf57315 (diff) | |
download | web-1b27fe03a87aad1ed693d6197633c7ade2e68a1f.tar.gz web-1b27fe03a87aad1ed693d6197633c7ade2e68a1f.tar.bz2 web-1b27fe03a87aad1ed693d6197633c7ade2e68a1f.zip |
Merge branch 'master' of ssh://git.spline.de/account-web
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -20,7 +20,7 @@ from wtforms.validators import Regexp -_username_re = re.compile(r'^[a-zA-Z][a-zA-Z0-9-]{1,15}') +_username_re = re.compile(r'^[a-zA-Z][a-zA-Z0-9-]{1,15}$') _username_exclude_re = re.compile(r'^(admin|root)') # using http://flask.pocoo.org/docs/patterns/viewdecorators/ @@ -234,7 +234,8 @@ def url_for(endpoint, **values): """Wrap `flask.url_for` so that it always returns https links""" #XXX: Drop this in favor of config.PREFERRED_URL_SCHEME when we require Flask 0.9 u = flask_url_for(endpoint, **values) - if '_external' in values and u.startswith('http://'): + if '_external' in values and u.startswith('http://') \ + and current_app.config['PREFERRED_URL_SCHEME'] == 'https': return 'https://' + u[7:] else: return u |