#NEWLINE# def ssl_required( allow_non_ssl = False ) : #NEWLINE# #INDENT# '\n    Views decorated with this will always get redirected to https\n    except when allow_non_ssl is set to true.\n    ' #NEWLINE# def wrapper( view_func ) : #NEWLINE# #INDENT# def _checkssl( request , * args , **kwargs ) : #NEWLINE# #INDENT# if ( hasattr ( settings , 'SSL_ENABLED' ) and settings . SSL_ENABLED and ( not request . is_secure ( ) ) and ( not allow_non_ssl ) ) : #NEWLINE# #INDENT# return HttpResponseRedirect ( request . build_absolute_uri ( ) . replace ( 'http://' , 'https://' ) ) #NEWLINE# #UNINDENT# return view_func ( request , * args , ** kwargs ) #NEWLINE# #UNINDENT# return _checkssl #NEWLINE# #UNINDENT# return wrapper