Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

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
Closed

underscore as route variable does not work #276

wichert opened this issue Sep 12, 2011 · 2 comments

Comments

@wichert
Copy link
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

@mcdonc
Copy link
Member

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 as completed in dceff57 Sep 12, 2011
@wichert
Copy link
Member Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants