django-lock

A protection method for Django views or complete sites
Download

django-lock Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Chris Beaven
  • Publisher web site:
  • http://code.google.com/u/smileychris/

django-lock Tags


django-lock Description

A protection method for Django views or complete sites django-lock is a plugin that allows you to lock down either individual views or your whole site.You have the option of an administrative preview password and the options to lock down until a date is reached and/or only start locking down some time in the future.Installation: 1. Copy (or symlink) the django_lock directory to your Python path. 2. Add 'django_lock' to your INSTALLED_APPS setting (only necessary if you are going to use the site-wide lock or the log out method)Using a site-wide lockAdd 'django_lock.middleware.LockMiddleware' to your MIDDLEWARE_CLASSES setting. Use the lock settings to configure the locking.Note that the django.static.views.serve view will not be locked if the DEBUG setting is True.Locking a viewFirst, import the lock decorator generator and create a decorator (you can create multiple ones if needed) and use it to decorate your views:from django_lock.decorators import lock protect = lock(preview_password='yourpassword', until_date=datetime(2009,1,1)) @protect def my_view(request): ...The arguments you can pass to lock are all optional. If you don't provide an argument, it will fall back to looking for it in the lock settings.Accepted arguments are preview_password, until_date and after_date with the same meanings as their related settings below.SettingsThe following settings are used for the site-wide middleware and provide defaults for lock decorators.LOCK_UNTIL_DATE Lock until the date (a datetime object) is reached.LOCK_AFTER_DATE Lock after the date (a datetime object) is reached.LOCK_PREVIEW_PASSWORD An administrative preview password (or passwords) allowing for previewing of the view/site while the lock is in place. It can be a string for a single password or a list/tuple for multiple passwords.LOCK_PASSTHROUGH Only used for the site-wide lock. Set to a list of URLs - any request starting with such a URL will not be locked. For example, LOCK_PASSTHROUGH = would allow access to http://yourserver/unsecure/.... Requirements: · Django · Python


django-lock Related Software