jace/werkzeug — pull request #1 by jasonLaster (2012-06-29 21:11:35+00:00)
Title: Fix issue 185

This patch fixes the inconsistency brought up in issue:185 "Complex URL routes are sorted incorrectly".

Instead of simply sorting by the number of parts in a rule, the router would now be smart enough to sort by the types of parts in the rule as well. The new heuristic counts the number of static parts, path parts, and other parts and then sorts lexographically in order:

1. number of static parts + weight fnc
2. number of other parts + weight fnc
3. number of path parts + weight fnc

where the weight fnc normalizes for the position of the various parts in the rule