Browse Source

Merge pull request #2752 from greyli/patch-9

Check whether there are registered routes
pull/2764/head
David Lord 7 years ago committed by GitHub
parent
commit
ad09134c8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      flask/cli.py

4
flask/cli.py

@ -825,6 +825,10 @@ def routes_command(sort, all_methods):
"""Show all registered routes with endpoints and methods.""" """Show all registered routes with endpoints and methods."""
rules = list(current_app.url_map.iter_rules()) 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')) ignored_methods = set(() if all_methods else ('HEAD', 'OPTIONS'))
if sort in ('endpoint', 'rule'): if sort in ('endpoint', 'rule'):

Loading…
Cancel
Save