Hi,

The generate method prefers to use the route which has the least
uncommon variables in it, but if route is not an exact match then a
route with most common variables must be selected I suppose. The
comment says the same thing but the code does the one I mentioned
above.

Here is what I mean
        self.mapper.connect('query', '/Property/
query/:pclass/:status/:city/:town/:district',
                            controller = 'Property', action="query",
pclass=False,
                            city=None, town=None, district=None,
status="all")
        self.mapper.connect(':controller/:action/:id',
controller="Main")
        print self.mapper.generate(controller="Property",
action="query", pclass="business")
---:
        outputs: /Property/query?pclass=business

Index: base.py
===================================================================
--- base.py     (revision 376)
+++ base.py     (working copy)
@@ -919,7 +919,7 @@
                 # Neither matches exactly, return the one with the
most in
                 # common
                 if cmp(lendiffa, lendiffb) != 0:
-                    return cmp(lendiffa, lendiffb)
+                   return cmp(len(keys&b), len(keys&a))

                 # Neither matches exactly, but if they both have just
as much
                 # in common

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to