Module Expr Str Assign NameStore Str Assign NameStore Str Assign NameStore Str ImportFrom alias ImportFrom alias alias ImportFrom alias Assign NameStore Call NameLoad NameLoad Str ListLoad Assign NameStore Str Assign NameStore Call NameLoad NameLoad Str NameLoad ClassDef bases body FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body If CompareIn NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad Delete SubscriptDel NameLoad Index NameLoad orelse Assign NameStore NameLoad If UnaryOpNot NameLoad body For NameStore NameLoad body If Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad body Assign NameStore NameLoad Break If UnaryOpNot CompareEq NameLoad Call NameLoad NameLoad body Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If BoolOpAnd AttributeLoad NameLoad attr CompareEq AttributeLoad NameLoad attr Str body Raise Call NameLoad Str Assign NameStore BoolOpOr BoolOpAnd NameLoad Str Str Assign NameStore BinOpMod Str TupleLoad NameLoad Call NameLoad NameLoad If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Str Str If BoolOpAnd NameLoad NameLoad body Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad Assign NameStore BinOpMod Str TupleLoad NameLoad Call AttributeLoad NameLoad attr Return Call NameLoad NameLoad decorator_list decorator_list
N/A N/A 
SSL Middleware
Stephen Zabel

This middleware answers the problem of redirecting to (and from) a SSL secured path
by stating what paths should be secured in urls.py file. To secure a path, add the
additional view_kwarg 'SSL':True to the view_kwargs.

For example

urlpatterns = patterns('some_site.some_app.views',
    (r'^test/secure/$','test_secure',{'SSL':True}),
     )

All paths where 'SSL':False or where the kwarg of 'SSL' is not specified are routed
to an unsecure path.

For example

urlpatterns = patterns('some_site.some_app.views',
    (r'^test/unsecure1/$','test_unsecure',{'SSL':False}),
    (r'^test/unsecure2/$','test_unsecure'),
     )

Gotcha's : Redirects should only occur during GETs; this is due to the fact that
POST data will get lost in the redirect.

A major benefit of this approach is that it allows you to secure django.contrib views
and generic views without having to modify the base code or wrapping the view.

This method is also better than the two alternative approaches of adding to the
settings file or using a decorator.

It is better than the tactic of creating a list of paths to secure in the settings
file, because you DRY. You are also not forced to consider all paths in a single
location. Instead you can address the security of a path in the urls file that it
is resolved in.

It is better than the tactic of using a @secure or @unsecure decorator, because
it prevents decorator build up on your view methods. Having a bunch of decorators
makes views cumbersome to read and looks pretty redundant. Also because the all
views pass through the middleware you can specify the only secure paths and the
remaining paths can be assumed to be unsecure and handled by the middleware.

This package is inspired by Antonio Cavedoni's SSL Middleware

Satchmo notes:
This package has also merged the main concepts of Antonio Cavedoni's SSL Middleware, 
to allow for better integration with other sites, and to easily allow admin pages to
be secured.

Lastly, we've added an optional "SSL_PORT" to be specified in the settings, for
unusual server configurations.  If specified, the port will be sent with the
SSL redirect.
 N/A __license__ Python N/A __copyright__ Copyright (C) 2007, Stephen Zabel N/A __author__ Stephen Zabel django.conf settings django.http HttpResponseRedirect get_host satchmo_utils request_is_secure N/A HTTPS_PATHS N/A getattr settings HTTPS_PATHS N/A N/A SSL SSL N/A SSLPORT N/A getattr settings SSL_PORT None SSLRedirect N/A N/A process_view N/A N/A self request view_func view_args view_kwargs N/A N/A N/A N/A SSL view_kwargs N/A N/A secure N/A view_kwargs N/A SSL N/A N/A view_kwargs N/A SSL N/A N/A secure False N/A N/A secure N/A N/A path HTTPS_PATHS N/A N/A N/A N/A N/A request path startswith N/A /%s path N/A N/A secure True N/A N/A N/A N/A secure N/A request_is_secure request N/A N/A N/A N/A self _redirect request secure N/A _redirect N/A N/A self request secure N/A N/A N/A N/A N/A settings DEBUG N/A N/A request method POST N/A N/A N/A RuntimeError Django can't perform a SSL redirect while maintaining POST data.
Please structure your views so that redirects only occur during GETs. N/A protocol N/A N/A secure https http N/A host N/A %s://%s N/A protocol N/A get_host request N/A N/A secure N/A N/A host N/A N/A host replace :443 N/A N/A secure SSLPORT N/A N/A host N/A %s:%s N/A host SSLPORT N/A newurl N/A %s%s N/A host N/A N/A request get_full_path N/A N/A HttpResponseRedirect newurl N/A N/A