'Revert to SSL/no SSL depending on settings'

def process_request(self, request):

    if getattr(settings, 'HARDTREE_SUBSCRIPTION_SSL_ENABLED', True):
        if (getattr(settings, 'HARDTREE_SUBSCRIPTION_SSL_ENFORCE', False) and (not request.is_secure())):
            redirect_url = request.build_absolute_uri()
            return HttpResponseRedirect(redirect_url.replace('https://', 'http://'))
    elif request.is_secure():
        redirect_url = request.build_absolute_uri()
        return HttpResponseRedirect(redirect_url.replace('https://', 'http://'))
