mozilla/zamboni — pull request #1614 by magopian (2014-01-10 14:43:21+00:00)
Title: fix clean_slug edge cases (bug 958124)

apps.addons.models.clean_slug failed on edge cases (seen in ES tests on amo, which aren't run on jenkins, cf bug 858447).

The tests should cope with all the edge cases, if you see any missing, please let me know.

The current implementation looks a bit limited (namely the "100 clashes" problem). I didn't want to over-engineer unless you feel it's worth it.

As an example, I've done another implementation on another project that could be adapted for our use case: this other implementation should not fail (unless there's a 27 digits long number of clashes), but it's a bit slower when there's clashes, as it does a request to the database on each clash. It could be improved to only do a new request when the "prefix" length changes.

Thoughts?