You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/home/oznt/Software/pypiserver/test.py", line 22, in <module>
@app.route(f"/packages/<pkg_version:re:{pattern}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/oznt/Software/pypiserver/pypiserver/bottle.py", line 925, in decorator
self.add_route(route)
File "/home/oznt/Software/pypiserver/pypiserver/bottle.py", line 873, in add_route
self.router.add(route.rule,
File "/home/oznt/Software/pypiserver/pypiserver/bottle.py", line 404, in add
raise RouteSyntaxError("Could not add Route: %s (%s)" % (rule, e))
pypiserver.bottle.RouteSyntaxError: Could not add Route: /packages/<pkg_version:re:(?P<project>.*)-(?P<version>.*)-(?P<constraints>.*-.*-.*)\.whl\.metadata$ (bad character in group name 'project)\\.\\*\\)\\-\\(\\?P(?P<version' at position 32)
My point is that it's worth documenting, even if only as an issue for the benefit of others.
I wanted to use wild card pattern with named groups, this was surprisingly easy, even thought the example in the docs is very terse.
As an example, consider the following:
This works suprisingly well. However, there is small annoyance in the API. I must also pass the filter key.
I patched bottle in the following way to allow a slightly more comfortable API which does not require passing the key,
e.g. the filter now injects only the groups to the function:
The complete app:
The patch:
Would you be interested in merging this?
The text was updated successfully, but these errors were encountered: