Skip to content

Commit

Permalink
Rename plugin from global to global_redirect
Browse files Browse the repository at this point in the history
That way we keep the `global` name available if we need a plugin to run
on the actual Indico Global instance later on
  • Loading branch information
ThiefMaster committed Dec 10, 2024
1 parent 03a2550 commit 8dd2889
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 20 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
from indico.core.plugins import IndicoPluginBlueprint


blueprint = IndicoPluginBlueprint('global', __name__)
blueprint = IndicoPluginBlueprint('global_redirect', __name__)
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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')))
Expand All @@ -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,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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.
"""
Expand Down
6 changes: 3 additions & 3 deletions global/pyproject.toml → global_redirect/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = '[email protected]' }]
Expand All @@ -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',
Expand Down

0 comments on commit 8dd2889

Please sign in to comment.