From 3e6779245265a7e7d699894fee25c1b6e81f7970 Mon Sep 17 00:00:00 2001 From: Michael Tofias Date: Tue, 31 Mar 2015 14:37:29 -0500 Subject: [PATCH] =?UTF-8?q?Ideas=20about=20Configing=E2=80=A6.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flask_sslify.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/flask_sslify.py b/flask_sslify.py index cdbd2d6..2ea3f09 100644 --- a/flask_sslify.py +++ b/flask_sslify.py @@ -9,10 +9,11 @@ class SSLify(object): """Secures your Flask App.""" def __init__(self, app=None, age=YEAR_IN_SECS, subdomains=False, permanent=False, skips=None): + self.app = app or current_app self.hsts_age = age - self.hsts_include_subdomains = subdomains or app.config.get('SSL_SUBDOMAINS') - self.permanent = permanent or app.config.get('SSL_PERMANENT') - self.skip_list = skips or app.config.get('SSL_SKIPS') + self.hsts_include_subdomains = subdomains or self.app.config.get('SSL_SUBDOMAINS') or subdomains + self.permanent = permanent or self.app.config.get('SSL_PERMANENT') or permanent + self.skip_list = skips or self.app.config.get('SSL_SKIPS') or skips if app is not None: self.init_app(app) @@ -36,7 +37,7 @@ class SSLify(object): def skip(self): """Checks the skip list.""" # Should we skip? - if self.skip_list and not isinstance(self.skip_list, basestring): + if self.skip_list and isinstance(self.skip_list, list): for skip in self.skip_list: if request.path.startswith('/{0}'.format(skip)): return True