Show More
@@ -61,12 +61,13 b' def add_route_with_slash(config,name, pa' | |||
|
61 | 61 | config.add_route(name + '_slash', pattern + '/', **kw) |
|
62 | 62 | |
|
63 | 63 | |
|
64 |
def add_route_requirements(route_path, requirements= |
|
|
64 | def add_route_requirements(route_path, requirements=None): | |
|
65 | 65 | """ |
|
66 | 66 | Adds regex requirements to pyramid routes using a mapping dict |
|
67 | 67 | e.g:: |
|
68 | 68 | add_route_requirements('{repo_name}/settings') |
|
69 | 69 | """ |
|
70 | requirements = requirements or URL_NAME_REQUIREMENTS | |
|
70 | 71 | for key, regex in requirements.items(): |
|
71 | 72 | route_path = route_path.replace('{%s}' % key, '{%s:%s}' % (key, regex)) |
|
72 | 73 | return route_path |
General Comments 0
You need to be logged in to leave comments.
Login now