Skip to content

Commit

Permalink
views: override view via config
Browse files Browse the repository at this point in the history
  • Loading branch information
jrcastro2 committed Jan 23, 2025
1 parent d785da4 commit a672885
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
6 changes: 5 additions & 1 deletion invenio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ from cds_rdm.permissions import (
)
from cds_rdm.files import storage_factory
from celery.schedules import crontab
from invenio_app_rdm.config import STATS_EVENTS as _APP_RDM_STATS_EVENTS, STATS_AGGREGATIONS as _APP_RDM_STATS_AGGREGATIONS
from invenio_app_rdm.config import STATS_EVENTS as _APP_RDM_STATS_EVENTS, STATS_AGGREGATIONS as _APP_RDM_STATS_AGGREGATIONS, APP_RDM_ROUTES
from invenio_vocabularies.services.custom_fields import VocabularyCF
from invenio_records_resources.services.custom_fields import KeywordCF
from invenio_rdm_records.config import (
Expand All @@ -42,6 +42,8 @@ from invenio_cern_sync.sso import cern_remote_app_name, cern_keycloak
from invenio_rdm_records.config import RDM_PERSISTENT_IDENTIFIERS, RDM_PARENT_PERSISTENT_IDENTIFIERS
from invenio_vocabularies.config import VOCABULARIES_NAMES_SCHEMES as DEFAULT_VOCABULARIES_NAMES_SCHEMES

from cds_rdm.views import frontpage_view_function

def _(x): # needed to avoid start time failure with lazy strings
return x

Expand Down Expand Up @@ -152,6 +154,8 @@ THEME_TRACKINGCODE_TEMPLATE = "cds_rdm/matomo-test.html"
# Instance's theme entrypoint file. Path relative to the ``assets/`` folder.
INSTANCE_THEME_FILE = './less/theme.less'

APP_RDM_ROUTES["index"] = ("/", frontpage_view_function)

# Invenio-communities
# ===================
# Communities permission policy
Expand Down
16 changes: 2 additions & 14 deletions site/cds_rdm/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,13 @@
"""CDS views."""


from flask import Blueprint, current_app, g, render_template
from flask import current_app, render_template
from flask_principal import AnonymousIdentity
from invenio_access.permissions import any_user
from invenio_communities import current_communities


def create_blueprint(app):
"""Blueprint for the routes and resources provided by Invenio-App-RDM."""
blueprint = Blueprint(
"cds_rdm_bp",
__name__,
template_folder="templates",
static_folder="static",
)
blueprint.add_url_rule("/", "index", view_func=index)
return blueprint


def index():
def frontpage_view_function():
"""Frontpage."""
anonymous_identity = AnonymousIdentity()
anonymous_identity.provides.add(any_user)
Expand Down
1 change: 0 additions & 1 deletion site/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ invenio_base.api_apps =
cds_rdm = cds_rdm:CDS_RDM_REST
invenio_base.blueprints =
cds_rdm_migration = cds_rdm.legacy.redirector:create_blueprint
cds_rdm_bp = cds_rdm.views:create_blueprint
invenio_celery.tasks =
cds_rdm_tasks = cds_rdm.tasks
invenio_jobs.jobs =
Expand Down

0 comments on commit a672885

Please sign in to comment.