cms.core.middleware package

Submodules

cms.core.middleware.base module

class cms.core.middleware.base.MaintenanceModeMiddleware

Bases: object

process_request(request)
process_response(request, response)
cms.core.middleware.base.ignore_paths(request)

cms.core.middleware.security module

class cms.core.middleware.security.AdditionalHeadersMiddleware

Bases: object

process_request(request)

Read DNT header from browser request and create request attribute

process_response(request, response)

Echo DNT header in response per section 8.4 of draft-mayer-do-not-track-00

class cms.core.middleware.security.SSLRedirectMiddleware

Bases: object

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.

Or just add SSL = True to app’s urls.py

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

Developer notice: django.conf.urls.url is patched through cms.core.monkeypatch

process_view(request, view_func, view_args, view_kwargs)

Module contents