defnull/bottle — pull request #473 by iurisilvio (2013-03-22 18:33:09+00:00)
Title: Add warning when an added route will never be reached

This pull request addresses a common issue with bottle, described in #452 and probably in other issues too (and mail list). It adds a warning when a route added will never be reached because the call matches other rule, resulting in a 405 error.

Following the decision in other issues, a warning is better than an unexpected behaviour. I decided to not raise an exception to not break existing code.

I know the best solution is handling both routes without a 405 when it is possible, but I know it will change a lot of Router code and probably impact performance a lot.

```python
>>> import bottle
>>> bottle.get('/')(lambda: 'x')
at 0x000000000281E7B8>
>>> bottle.get('/')(lambda: 'y')
bottle.py:345: RuntimeWarning: Route shadow (calls to "GET /" will match with
"GET /")
warnings.warn('Route shadow (calls to "%s %s" will match with "%s")' % (method
, rule, a[1]), RuntimeWarning)
```

I don't know if "shadow" is the right name to it.