edit – the question was not properly researched. The problem turned out to be that the map was not being matched against the url I thought it was.
I understand basically how the mechanism works: odd-numbered entries are treated as regular expressions, and they are automatically encapsulated with ^ and $. What I’m hoping somebody can explain is how web.py chooses which entry to use when multiple patterns match.
For example, let’s say we matched the url / against this mapping:
urls = (
'/' , 'index',
'/.*' , 'details')
I would expect web.py to choose the first match, index, but instead it chooses details. Why? Does it look for the last match? Or the most specific match? If it’s specificity, how is that determined, string length? Or is it unpredictable?
It regular expression match, and the first match get chosen. Here “.*” means any thing or nothing, for details you can refer regular expression syntax. If you give it:
It should choose the first — “index”
For:
it should choose “details”