Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

underscore as route variable does not work #276

Closed
wichert opened this Issue Sep 12, 2011 · 2 comments

Comments

Projects
None yet
2 participants
Member

wichert commented Sep 12, 2011

I have a configured route which uses a very minimal variable name:

config.add_route('retailer-view-feed-view-update',
        '/retailers/{_:\d+}/feed/{feed_id:\d+}/update/{id:\d+}',
        factory='s4u.dataentry.ui.factories.feed')

When using request.route_url to generate a URL for that route the _ variable is not expanded. Instead the resulting URL looks like this: http://localhost:5000/retailers/%7B_:/d+%7D/feed/1/update/18

Owner

mcdonc commented Sep 12, 2011

I looked at the code, and this is indeed true. The pattern used to match dynamic parts is effectively

(\{[a-zA-Z][^\}]*\})

This isn't spelled out very well in the docs though. I'm apt to just allow underscore too, and indicate that
the name between the squigglies can start with a-z or _.

@mcdonc mcdonc closed this in dceff57 Sep 12, 2011

Member

wichert commented Sep 12, 2011

Works for me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment