dot in route pattern

14 views
Skip to first unread message

Jason

unread,
Jul 19, 2011, 2:59:35 PM7/19/11
to pylons-...@googlegroups.com
The documentation at http://www.kemeneur.com/clients/pylons/docs/pyramid/narr/urldispatch.html (under Route Pattern Syntax) shows that I could put "/{action}.{ext}" as a route pattern and both would come up as matchdict values.

When I try this I get the action, but not the ext. Is this a bug in route matching, the documentation, or my understanding?

Thanks,

Jason

Chris McDonough

unread,
Jul 19, 2011, 8:04:27 PM7/19/11
to pylons-...@googlegroups.com
On Tue, 2011-07-19 at 11:59 -0700, Jason wrote:
> The documentation at
> http://www.kemeneur.com/clients/pylons/docs/pyramid/narr/urldispatch.html (under Route Pattern Syntax) shows that I could put "/{action}.{ext}" as a route pattern and both would come up as matchdict values.

FTR, that's a very old copy of the docs; the "right" ones are at
http://docs.pylonsproject.org/docs/pyramid.html


> When I try this I get the action, but not the ext. Is this a bug in
> route matching, the documentation, or my understanding?

Here's an example program. When you put this in a file (as e.g.
matching.py) and run it:

- /bar will show you an empty dict to your browser
- /something.foo will show you a nonempty dict including the extension

from pyramid.config import Configurator
from pyramid.view import view_config

from paste.httpserver import serve

@view_config(route_name='foo', renderer='string')
def foo(request):
return request.matchdict

@view_config(route_name='bar', renderer='string')
def bar(request):
return request.matchdict

if __name__ == '__main__':
config = Configurator()
config.add_route('foo', '/{name}.{ext}')
config.add_route('bar', '/bar')
config.scan('__main__')
app = config.make_wsgi_app()
serve(app)

Can you modify this to show the symptom you're experiencing?

- C

Jason

unread,
Jul 20, 2011, 9:26:36 AM7/20/11
to pylons-...@googlegroups.com
My mistake; I had a route pattern with just "/{action}" above the one containing a dot. So it matched the action as being the entire string before getting to the pattern with the dot in it.

--Jason
Reply all
Reply to author
Forward
0 new messages