From fd6d7f8b7ae79c81940042eeb59c4e0508afee9f Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Fri, 3 Sep 2021 12:35:04 +0100 Subject: [PATCH 1/2] Remove redundant command to migrate areas The data migration is now complete. --- app/commands.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/app/commands.py b/app/commands.py index 4437e9005..63a3e218b 100644 --- a/app/commands.py +++ b/app/commands.py @@ -11,23 +11,5 @@ def list_routes(): print("{:10} {}".format(", ".join(rule.methods - set(['OPTIONS', 'HEAD'])), rule.rule)) # noqa -@click.command() -@click.argument('csv_path') -@click.argument('for_reals') -@with_appcontext -def tmp_backfill_areas(csv_path, for_reals=False): - import csv - - from app.models.broadcast_message import BroadcastMessage - - for id, service_id in csv.reader(open(csv_path)): - message = BroadcastMessage.from_id(id, service_id=service_id) - print(f'Updating {message.id}') # noqa - - if for_reals: - message._update_areas(force_override=True) - - def setup_commands(application): application.cli.add_command(list_routes) - application.cli.add_command(tmp_backfill_areas) From 748ba2fdeea4c9767ba8731ff0b827529e300863 Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Tue, 7 Sep 2021 09:35:45 +0100 Subject: [PATCH 2/2] Remove pointless 'list-routes' command This is superseded by the native 'flask routes' command. --- app/__init__.py | 3 --- app/commands.py | 15 --------------- 2 files changed, 18 deletions(-) delete mode 100644 app/commands.py diff --git a/app/__init__.py b/app/__init__.py index 74dabc698..97dac82fc 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -33,7 +33,6 @@ from werkzeug.local import LocalProxy from app import proxy_fix, webauthn_server from app.asset_fingerprinter import asset_fingerprinter -from app.commands import setup_commands from app.config import configs from app.extensions import antivirus_client, redis_client, zendesk_client from app.formatters import ( @@ -151,8 +150,6 @@ navigation = { def create_app(application): - setup_commands(application) - notify_environment = os.environ['NOTIFY_ENVIRONMENT'] application.config.from_object(configs[notify_environment]) diff --git a/app/commands.py b/app/commands.py deleted file mode 100644 index 63a3e218b..000000000 --- a/app/commands.py +++ /dev/null @@ -1,15 +0,0 @@ -import click -from flask import current_app -from flask.cli import with_appcontext - - -@click.command('list-routes') -@with_appcontext -def list_routes(): - """List URLs of all application routes.""" - for rule in sorted(current_app.url_map.iter_rules(), key=lambda r: r.rule): - print("{:10} {}".format(", ".join(rule.methods - set(['OPTIONS', 'HEAD'])), rule.rule)) # noqa - - -def setup_commands(application): - application.cli.add_command(list_routes)