Check whether exist registered routes

This commit is contained in:
Grey Li 2018-05-02 17:08:31 +08:00 committed by David Lord
parent a6a6810d56
commit b4e092600d
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8

View file

@ -825,6 +825,10 @@ def routes_command(sort, all_methods):
"""Show all registered routes with endpoints and methods."""
rules = list(current_app.url_map.iter_rules())
if not rules:
click.echo('No routes were registered.')
return
ignored_methods = set(() if all_methods else ('HEAD', 'OPTIONS'))
if sort in ('endpoint', 'rule'):