Skip to content

Instantly share code, notes, and snippets.

"""
=============
stringmethods
=============
Make possible to use all Python string methods as Django template filters. Also
provide custom template tag ``{% stringmethod %}`` to use methods with more
than one argument, like ``format``, ``count`` and other.
Restrictions
@e-yes
e-yes / urlnorm.py
Created February 2, 2010 17:33 — forked from mnot/urlnorm.py
urlnorm.py - URL normalisation routines
#!/usr/bin/env python
"""
urlnorm.py - URL normalisation routines
urlnorm normalises a URL by;
* lowercasing the scheme and hostname
* taking out default port if present (e.g., http://www.foo.com:80/)
* collapsing the path (./, ../, etc)
* removing the last character in the hostname if it is '.'