summaryrefslogtreecommitdiff
path: root/pgweb/util/middleware.py
diff options
context:
space:
mode:
authorMarti Raudsepp2012-11-07 21:11:21 +0000
committerMagnus Hagander2012-11-11 15:07:05 +0000
commit557c44fab599769c566a53f7120d798672e2d6b9 (patch)
tree018f33af588265794bb6cfcaebcf06379930e65a /pgweb/util/middleware.py
parent6ba4f789ed69f12eb5f63ca8618b91563ee686a6 (diff)
Update @ssl_required decorator to play nice with other decorators
The decorator now retains all attributes of the original view and adds a new 'view.ssl_required = True' attribute.
Diffstat (limited to 'pgweb/util/middleware.py')
-rw-r--r--pgweb/util/middleware.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/pgweb/util/middleware.py b/pgweb/util/middleware.py
index 3b438fe7..ab0523b8 100644
--- a/pgweb/util/middleware.py
+++ b/pgweb/util/middleware.py
@@ -30,7 +30,7 @@ class PgMiddleware(object):
return HttpResponseRedirect(request.build_absolute_uri().replace('http://','https://',1))
return None
- if view_func.__name__ == '_require_ssl':
+ if getattr(view_func, 'ssl_required', False):
# This view requires SSL, so check if we have it
if not request.is_secure():
# May need to deal with ports specified here?