This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

A few tools for helping with case-insensitvity in Django URLs.

  • 404 handler that redirects non-matched, non-lowercase URLs. E.g. if /About/ is not matched, the handler will redirect to /about/ before returning a 404
  • Middleware that enforces lower-cased URLs. E.g. all non-lowercased URLs will be redirected to their lowercased form.

Overview

If you only need to match URL patterns, then it’s simple to add case-insensitivity to your regular expressions.:

urlpatterns = patterns('',
    (r'^(?i)admin/(.*)', admin.site.root),
    (r'^(?i)static/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.STATIC_DOC_ROOT, 'show_indexes': True}),
    (r'^(?i)login/$', 'django.contrib.auth.views.login'),
    (r'^(?i)logout/$', do_logout),
)

From Alex Martelli’s Stack Overflow explanation.

However this doesn’t do anything to match slugs, which are often case-sensitive matched by default - it’s up to the app. If the app uses a straightforward = expression, e.g.:

object = MyModel.objects.get(slug=slug)

Then MySlug won’t match myslug.

There are also instances where you want to enforce URL casing for other reasons (or a client does!).

Installation

Install django-icase:

pip install django-icase

To use the custom 404 handler, simply specify this in your project urls.py configuration.:

handler404 = 'icase.views.icase_404_handler'

To use the lowercasing middleware, add it to your INSTALLED_MIDDLEWARE.:

INSTALLED_MIDDLEWARE = (
    'icase.middleware.LowerCased',
    ...
)

Django & Python support

Actively supported versions of Django are supported by this app, although there is little reason it should not work on others.

Tested against Python 3 and Python 2.7.9.

History

0.1.1 (2015-05-06)

  • Update django-nose reference to support Django 1.7+

0.1.0 (2015-03-25)

  • First release on PyPI.
Release History

Release History

0.1.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_icase-0.1.1-py2.py3-none-any.whl (8.4 kB) Copy SHA256 Checksum SHA256 2.7 Wheel May 6, 2015
django-icase-0.1.1.tar.gz (5.8 kB) Copy SHA256 Checksum SHA256 Source May 6, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting