del view_kwargs[SSL] will delete the SSL keyword and if you don't want to redirect, then comment out the if not secure == request_is_secure(request) statement
-Chris On Sun, Nov 15, 2009 at 6:41 PM, neridaj <[email protected]> wrote: > > Hello, > > I'm new to python and I'm not quite sure how I would go about deleting > the SSL keyword from the redirect middleware. I've tried but I'm not > having much luck, and I'm sure this is super easy to do. > > class SSLRedirect: > def process_view(self, request, view_func, view_args, > view_kwargs): > if SSL in view_kwargs: > secure = view_kwargs[SSL] > del view_kwargs[SSL] > else: > secure = False > > if not secure: > for path in HTTPS_PATHS: > if request.path.startswith("/%s" % path): > secure = True > break > > if not secure == request_is_secure(request): > return self._redirect(request, secure) > > def _redirect(self, request, secure): > if settings.DEBUG and request.method == 'POST': > raise RuntimeError( > """Django can't perform a SSL redirect while maintaining POST data. > Please structure your views so that redirects only occur during > GETs.""") > > protocol = secure and "https" or "http" > host = "%s://%s" % (protocol, get_host(request)) > # In certain proxying situations, we need to strip out the 443 > port > # in order to prevent inifinite redirects > if not secure: > host = host.replace(':443','') > if secure and SSLPORT: > host = "%s:%s" % (host, SSLPORT) > > newurl = "%s%s" % (host, request.get_full_path()) > > return HttpResponseRedirect(newurl) > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en -~----------~----~----~----~------~----~------~--~---
