diff options
Diffstat (limited to 'examples/partial/complex_routing.py')
| -rw-r--r-- | examples/partial/complex_routing.py | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/examples/partial/complex_routing.py b/examples/partial/complex_routing.py index 18ce7b0a..596d00e4 100644 --- a/examples/partial/complex_routing.py +++ b/examples/partial/complex_routing.py @@ -1,19 +1,43 @@ -from werkzeug.routing import Map, Rule, Subdomain, Submount, EndpointPrefix +from werkzeug.routing import EndpointPrefix +from werkzeug.routing import Map +from werkzeug.routing import Rule +from werkzeug.routing import Subdomain +from werkzeug.routing import Submount -m = Map([ - # Static URLs - EndpointPrefix('static/', [ - Rule('/', endpoint='index'), - Rule('/about', endpoint='about'), - Rule('/help', endpoint='help'), - ]), - # Knowledge Base - Subdomain('kb', [EndpointPrefix('kb/', [ - Rule('/', endpoint='index'), - Submount('/browse', [ - Rule('/', endpoint='browse'), - Rule('/<int:id>/', defaults={'page': 1}, endpoint='browse'), - Rule('/<int:id>/<int:page>', endpoint='browse') - ]) - ])]) -]) +m = Map( + [ + # Static URLs + EndpointPrefix( + "static/", + [ + Rule("/", endpoint="index"), + Rule("/about", endpoint="about"), + Rule("/help", endpoint="help"), + ], + ), + # Knowledge Base + Subdomain( + "kb", + [ + EndpointPrefix( + "kb/", + [ + Rule("/", endpoint="index"), + Submount( + "/browse", + [ + Rule("/", endpoint="browse"), + Rule( + "/<int:id>/", + defaults={"page": 1}, + endpoint="browse", + ), + Rule("/<int:id>/<int:page>", endpoint="browse"), + ], + ), + ], + ) + ], + ), + ] +) |
