Remove SSL optional tag
authorMagnus Hagander <magnus@hagander.net>
Thu, 19 May 2016 17:34:44 +0000 (13:34 -0400)
committerMagnus Hagander <magnus@hagander.net>
Tue, 24 May 2016 19:13:00 +0000 (21:13 +0200)
pgweb/core/views.py
pgweb/util/decorators.py
pgweb/util/middleware.py

index 4cc2e53a87d0a3296e0dad59d751adede1c54020..00d9c5d704cbf7e347dd71ed42be2b97601c0be2 100644 (file)
@@ -15,7 +15,7 @@ import os
 import re
 import urllib
 
-from pgweb.util.decorators import ssl_required, ssl_optional, cache, nocache
+from pgweb.util.decorators import ssl_required, cache, nocache
 from pgweb.util.contexts import NavContext
 from pgweb.util.helpers import simple_form, PgXmlHelper, HttpServerError
 from pgweb.util.moderation import get_all_pending_moderations
@@ -174,7 +174,7 @@ _dynamic_cssmap = {
                         'media/css/text.css',
                     'media/css/docs.css'],
        }
-@ssl_optional
+
 @cache(hours=6)
 def dynamic_css(request, css):
        if not _dynamic_cssmap.has_key(css):
index a76ecc987bd137f3c5e1b2058b5bc39e145b9481..abfbc70cd5ef39cbf4efe465f3e23e0426d00d5d 100644 (file)
@@ -1,20 +1,6 @@
 import datetime
 from functools import wraps
 
-def ssl_required(fn):
-       def _require_ssl(request, *_args, **_kwargs):
-               return fn(request, *_args, **_kwargs)
-       _require_ssl.ssl_required = True
-       # wraps retains original function attributes such as __name__, csrf_exempt, etc
-       return wraps(_require_ssl)(fn)
-
-def ssl_optional(fn):
-       def _optional_ssl(request, *_args, **_kwargs):
-               return fn(request, *_args, **_kwargs)
-       _optional_ssl.ssl_optional = True
-       # wraps retains original function attributes such as __name__, csrf_exempt, etc
-       return wraps(_optional_ssl)(fn)
-
 def nocache(fn):
        def _nocache(request, *_args, **_kwargs):
                resp = fn(request, *_args, **_kwargs)
index 41af91571c67cd3d1a1dceedfe0bb63a45a93b76..f389862ee2ae6c5651b39e224c3791fa097cebf8 100644 (file)
@@ -24,11 +24,6 @@ class PgMiddleware(object):
                if hasattr(settings,'NO_HTTPS_REDIRECT') and settings.NO_HTTPS_REDIRECT:
                        return None
 
-               # Does this view allow both SSL and non-ssl?
-               if getattr(view_func, 'ssl_optional', False):
-                       # SSL is optional, so perform no redirects
-                       return None
-
                # Always redirect the admin interface to https
                if request.path.startswith('/admin'):
                        if not request.is_secure():