diff options
author | Michael Elkins <melkins@tislabs.com> | 2015-03-04 23:49:44 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2015-03-04 23:49:44 +0000 |
commit | 8bc4171157cee26f08c3e131e1f7f905b9e1efb6 (patch) | |
tree | 74d94e205d96cd917023da17c8c5f578ffdf9bb8 /rpki | |
parent | 42f0e820f02cb6283a2e77da953e8d0f26e9765c (diff) |
don't require TLS when DEBUG=True
This is useful for running the Django test webserver without TLS support.
svn path=/trunk/; revision=6065
Diffstat (limited to 'rpki')
-rw-r--r-- | rpki/gui/decorators.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/rpki/gui/decorators.py b/rpki/gui/decorators.py index 69d20c46..b5c52afb 100644 --- a/rpki/gui/decorators.py +++ b/rpki/gui/decorators.py @@ -15,6 +15,7 @@ __version__ = '$Id$' from django import http +from django.conf import settings def tls_required(f): @@ -23,9 +24,9 @@ def tls_required(f): """ def _tls_required(request, *args, **kwargs): - if not request.is_secure(): - return http.HttpResponseServerError( - 'This resource may only be accessed securely via https', - content_type='text/plain') - return f(request, *args, **kwargs) + if settings.DEBUG or request.is_secure(): + return f(request, *args, **kwargs) + return http.HttpResponseServerError( + 'This resource may only be accessed securely via https', + content_type='text/plain') return _tls_required |