zacharyvoase/slugify — pull request #1 by ksamuel (2012-07-22 18:23:42+00:00)
Title: Unobtrusive improvements: won't change the API

I ran:

>>> unidecode_slugify(u"Héllø Wörld")

In a shell and didn't get:

u'hello-world'

But:

u'hell-world'

So I took the chance to make small improvements to this lib. It's 100% compatible with the previous version.

Slugify() now uses the unidecode library if (and only if) installed.

Unidecode is listed as an optional dependancy in setup.py (I had to switch to setuptools for this, but you can remove this specific change without impacting the benefit of the other changes).

There are 3 subfonctions one can use separatly if one wishes to use either unidecode, unicodedata or juste keep non ASCII characters, but most people will just do:

>>> from slugify import slugify as usuall

(slugify() is now an alias to the best fonction available).

You can pass a different separator than "-" although it is the default value. Some people like their slugs with '_', and this lib can be useful to normalize strings for another purpose than for the Web (E.G: filename for scripting).

The code is backed up with doctests to ensure I didn't destroy your work and help with further improvements.

I did update the README but I advice proof reading as I'm not a native english speaker.

Cheers !