Skip to main content

Django-urldecorators is a reusable Django application which allows apply view decorators and middleware components depending on requested url.

Project description

Django-urldecorators is a reusable Django application which allows apply
view decorators and middleware components depending on requested url.


Installation and usage:

1) Run python setup.py install or add urldecorators directory to
your PYTHONPATH

2) In urls.py file replace `from django.conf.urls.defaults import *`
by `from urldecorators.defaults import *`

3) Pass list of decorators and/or middleware_classes as argument
to url function


Example urls.py file:

from urldecorators.defaults import *

urlpatterns = patterns('',
url(r'^private/$', include('example.private.urls'),
decorators=['django.contrib.auth.decorators.login_required']),
url(r'^articles/$', include('example.articles.urls'),
middleware_classes=['django.middleware.cache.CacheMiddleware']),
)


Testing:

# Setup testing enviroment (uses zc.buildout)
cd test
python bootstrap.py
python bin/buildout-script.py
# Run tests using miscellaneous Django versions
bin/test-django-1.0
bin/test-django-1.1
bin/test-django-1.2
bin/test-django-1.3
# Create database
bin/manage-django-1.0 syncdb
# Run server using miscellaneous Django versions
bin/manage-django-1.0 runserver
bin/manage-django-1.1 runserver
bin/manage-django-1.2 runserver
bin/manage-django-1.3 runserver

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-urldecorators-0.3.zip (11.5 kB view details)

Uploaded Source

File details

Details for the file django-urldecorators-0.3.zip.

File metadata

File hashes

Hashes for django-urldecorators-0.3.zip
Algorithm Hash digest
SHA256 031967291a6bb914efacc49bbb8fe0f74646bcf47ce786cdddf43194f7eae9c0
MD5 dd6c9447731951b17ebb1d4a4de3cb68
BLAKE2b-256 9627a94977573eae3e71f5872a58470de8b22dd5bcc0cd5f69c670e438dcafb1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page