From 627ad9a0087ea754b57fdad58a44cc1a869e90cc Mon Sep 17 00:00:00 2001 From: Adrian Moennich Date: Tue, 10 Dec 2024 14:56:40 +0100 Subject: [PATCH] Rename plugin from global to global_redirect That way we keep the `global` name available if we need a plugin to run on the actual Indico Global instance later on --- .github/workflows/build.yml | 2 +- .../indico_global_redirect}/__init__.py | 0 .../indico_global_redirect}/blueprint.py | 2 +- .../indico_global_redirect}/cli.py | 12 ++++++------ .../indico_global_redirect}/migrations/.no-header | 0 .../20241018_1222_69b478f8e2ca_add_mapping_table.py | 8 ++++---- .../indico_global_redirect}/models/__init__.py | 0 .../indico_global_redirect}/models/id_map.py | 2 +- .../indico_global_redirect}/plugin.py | 10 +++++----- .../templates/emails/cat_notification.txt | 0 .../templates/emails/event_notification.txt | 0 {global => global_redirect}/pyproject.toml | 6 +++--- 12 files changed, 21 insertions(+), 21 deletions(-) rename {global/indico_global => global_redirect/indico_global_redirect}/__init__.py (100%) rename {global/indico_global => global_redirect/indico_global_redirect}/blueprint.py (83%) rename {global/indico_global => global_redirect/indico_global_redirect}/cli.py (90%) rename {global/indico_global => global_redirect/indico_global_redirect}/migrations/.no-header (100%) rename {global/indico_global => global_redirect/indico_global_redirect}/migrations/20241018_1222_69b478f8e2ca_add_mapping_table.py (73%) rename {global/indico_global => global_redirect/indico_global_redirect}/models/__init__.py (100%) rename {global/indico_global => global_redirect/indico_global_redirect}/models/id_map.py (95%) rename {global/indico_global => global_redirect/indico_global_redirect}/plugin.py (97%) rename {global/indico_global => global_redirect/indico_global_redirect}/templates/emails/cat_notification.txt (100%) rename {global/indico_global => global_redirect/indico_global_redirect}/templates/emails/event_notification.txt (100%) rename {global => global_redirect}/pyproject.toml (86%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fda74192..6346b27d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ on: - conversion - cronjobs_cern - foundationsync - - global + - global_redirect - i18n_demo - labotel - outlook diff --git a/global/indico_global/__init__.py b/global_redirect/indico_global_redirect/__init__.py similarity index 100% rename from global/indico_global/__init__.py rename to global_redirect/indico_global_redirect/__init__.py diff --git a/global/indico_global/blueprint.py b/global_redirect/indico_global_redirect/blueprint.py similarity index 83% rename from global/indico_global/blueprint.py rename to global_redirect/indico_global_redirect/blueprint.py index 902f91f8..e3899c0a 100644 --- a/global/indico_global/blueprint.py +++ b/global_redirect/indico_global_redirect/blueprint.py @@ -8,4 +8,4 @@ from indico.core.plugins import IndicoPluginBlueprint -blueprint = IndicoPluginBlueprint('global', __name__) +blueprint = IndicoPluginBlueprint('global_redirect', __name__) diff --git a/global/indico_global/cli.py b/global_redirect/indico_global_redirect/cli.py similarity index 90% rename from global/indico_global/cli.py rename to global_redirect/indico_global_redirect/cli.py index 6b072264..e050e232 100644 --- a/global/indico_global/cli.py +++ b/global_redirect/indico_global_redirect/cli.py @@ -24,12 +24,12 @@ from indico.modules.events import Event from indico.util.console import verbose_iterator -from indico_global.models.id_map import GlobalIdMap +from indico_global_redirect.models.id_map import GlobalIdMap @cli_group(name='global') def cli(): - """Manage the Global plugin.""" + """Manage the Global Redirect plugin.""" @cli.command() @@ -55,10 +55,10 @@ def load_mapping(mapping_file): @cli.command() def notify_category_managers(): """Notify category managers about upcoming migration.""" - from indico_global.plugin import GlobalPlugin + from indico_global_redirect.plugin import GlobalRedirectPlugin SettingsProxyBase.allow_cache_outside_request = True # avoid re-querying site_title for every email - global_cat = Category.get(GlobalPlugin.settings.get('global_category_id')) + global_cat = Category.get(GlobalRedirectPlugin.settings.get('global_category_id')) query = (global_cat.deep_children_query .filter(~Category.is_deleted, Category.acl_entries.any()) .options(subqueryload(Category.acl_entries), undefer('chain_titles'))) @@ -83,10 +83,10 @@ def notify_category_managers(): @cli.command() def notify_event_managers(): """Notify event managers about upcoming migration.""" - from indico_global.plugin import GlobalPlugin + from indico_global_redirect.plugin import GlobalRedirectPlugin SettingsProxyBase.allow_cache_outside_request = True # avoid re-querying site_title for every email - global_cat = Category.get(GlobalPlugin.settings.get('global_category_id')) + global_cat = Category.get(GlobalRedirectPlugin.settings.get('global_category_id')) query = (Event.query .filter(Event.category_chain_overlaps(global_cat.id), ~Event.is_deleted, diff --git a/global/indico_global/migrations/.no-header b/global_redirect/indico_global_redirect/migrations/.no-header similarity index 100% rename from global/indico_global/migrations/.no-header rename to global_redirect/indico_global_redirect/migrations/.no-header diff --git a/global/indico_global/migrations/20241018_1222_69b478f8e2ca_add_mapping_table.py b/global_redirect/indico_global_redirect/migrations/20241018_1222_69b478f8e2ca_add_mapping_table.py similarity index 73% rename from global/indico_global/migrations/20241018_1222_69b478f8e2ca_add_mapping_table.py rename to global_redirect/indico_global_redirect/migrations/20241018_1222_69b478f8e2ca_add_mapping_table.py index 924998af..ba519eef 100644 --- a/global/indico_global/migrations/20241018_1222_69b478f8e2ca_add_mapping_table.py +++ b/global_redirect/indico_global_redirect/migrations/20241018_1222_69b478f8e2ca_add_mapping_table.py @@ -18,16 +18,16 @@ def upgrade(): - op.execute(CreateSchema('plugin_global')) + op.execute(CreateSchema('plugin_global_redirect')) op.create_table( 'id_map', sa.Column('col', sa.String(), primary_key=True), sa.Column('local_id', sa.Integer(), primary_key=True), sa.Column('global_id', sa.Integer(), nullable=False), - schema='plugin_global', + schema='plugin_global_redirect', ) def downgrade(): - op.drop_table('id_map', schema='plugin_global') - op.execute(DropSchema('plugin_global')) + op.drop_table('id_map', schema='plugin_global_redirect') + op.execute(DropSchema('plugin_global_redirect')) diff --git a/global/indico_global/models/__init__.py b/global_redirect/indico_global_redirect/models/__init__.py similarity index 100% rename from global/indico_global/models/__init__.py rename to global_redirect/indico_global_redirect/models/__init__.py diff --git a/global/indico_global/models/id_map.py b/global_redirect/indico_global_redirect/models/id_map.py similarity index 95% rename from global/indico_global/models/id_map.py rename to global_redirect/indico_global_redirect/models/id_map.py index 0e423beb..147e88ea 100644 --- a/global/indico_global/models/id_map.py +++ b/global_redirect/indico_global_redirect/models/id_map.py @@ -13,7 +13,7 @@ class GlobalIdMap(db.Model): __tablename__ = 'id_map' - __table_args__ = {'schema': 'plugin_global'} + __table_args__ = {'schema': 'plugin_global_redirect'} col = db.Column(db.String, primary_key=True) local_id = db.Column(db.Integer, primary_key=True) diff --git a/global/indico_global/plugin.py b/global_redirect/indico_global_redirect/plugin.py similarity index 97% rename from global/indico_global/plugin.py rename to global_redirect/indico_global_redirect/plugin.py index 4a1ef4dd..eb55d211 100644 --- a/global/indico_global/plugin.py +++ b/global_redirect/indico_global_redirect/plugin.py @@ -25,9 +25,9 @@ from indico.web.forms.base import IndicoForm from indico.web.forms.widgets import SwitchWidget -from indico_global.blueprint import blueprint -from indico_global.cli import cli -from indico_global.models.id_map import GlobalIdMap +from indico_global_redirect.blueprint import blueprint +from indico_global_redirect.cli import cli +from indico_global_redirect.models.id_map import GlobalIdMap ID_ARG_MAP = { @@ -97,8 +97,8 @@ def _is_request_likely_seen(): ) -class GlobalPlugin(IndicoPlugin): - """Indico Global +class GlobalRedirectPlugin(IndicoPlugin): + """Indico Global Redirect Provides functionality related to Indico Global on the main Indico instance. """ diff --git a/global/indico_global/templates/emails/cat_notification.txt b/global_redirect/indico_global_redirect/templates/emails/cat_notification.txt similarity index 100% rename from global/indico_global/templates/emails/cat_notification.txt rename to global_redirect/indico_global_redirect/templates/emails/cat_notification.txt diff --git a/global/indico_global/templates/emails/event_notification.txt b/global_redirect/indico_global_redirect/templates/emails/event_notification.txt similarity index 100% rename from global/indico_global/templates/emails/event_notification.txt rename to global_redirect/indico_global_redirect/templates/emails/event_notification.txt diff --git a/global/pyproject.toml b/global_redirect/pyproject.toml similarity index 86% rename from global/pyproject.toml rename to global_redirect/pyproject.toml index 9f8411a7..3ae67e81 100644 --- a/global/pyproject.toml +++ b/global_redirect/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = 'indico-plugin-global' +name = 'indico-plugin-global-redirect' version = '3.3-dev' license = 'MIT' authors = [{ name = 'Indico Team', email = 'indico-team@cern.ch' }] @@ -16,14 +16,14 @@ dependencies = ['indico>=3.3'] GitHub = 'https://github.com/indico/indico-plugins-cern' [project.entry-points.'indico.plugins'] -global = 'indico_global.plugin:GlobalPlugin' +global_redirect = 'indico_global_redirect.plugin:GlobalRedirectPlugin' [build-system] requires = ['hatchling==1.25.0'] build-backend = 'hatchling.build' [tool.hatch.build] -packages = ['indico_global'] +packages = ['indico_global_redirect'] exclude = [ '*.no-header', '.keep',