Compare commits

...

15 Commits

Author SHA1 Message Date
ab8a357137 Added logger output on error 500
Cherry picked and tweaked from
fdec916528
2025-06-06 16:34:32 +01:00
6cba9a6d2b Patch: revert static routes from package level to relative 2025-06-06 14:51:59 +01:00
b66f7a75df Version bump 2025-06-06 14:13:54 +01:00
b02b7aca14 Revert "Removed lom to fix py3.13 issues"
This reverts commit 926196b30f.
2025-06-06 14:13:26 +01:00
56d5d223f3 Version bump 2025-06-06 13:56:11 +01:00
c14168c194 Lock bump 2025-06-06 13:55:22 +01:00
5b71404fda removed depedency on i18n 2025-06-06 13:54:32 +01:00
926196b30f Removed lom to fix py3.13 issues 2025-06-06 13:54:14 +01:00
e74d2017fc Version bump 2025-06-06 13:15:29 +01:00
ef1f268298 Template reference fixes 2025-06-06 13:14:58 +01:00
af61f927f1 Removed translations entrypoint as was unused 2025-06-06 12:51:57 +01:00
d5b9686302 Switched blueprint creation to newer flask style
Noticed and cherry picked from tugraz theme during debugging of plugin
build issues. See:
62c572e483
2025-06-06 12:51:17 +01:00
c5bd3d138e Attempt to fix loading issues when oauth is not responding 2025-06-03 11:08:36 +01:00
d5f63f4387 Add dependabot config 2025-05-27 17:52:05 +01:00
f7d0aa1bcf patch: Added missing dependency 2025-05-27 13:26:31 +01:00
12 changed files with 147 additions and 44 deletions

29
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
version: 2
updates:
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "04:00"
open-pull-requests-limit: 8
allow:
- dependency-type: "all"
reviewers:
- "Cian-H"
assignees:
- "Cian-H"
commit-message:
prefix: "uv-deps"
prefix-development: "uv-deps-dev"
include: "scope"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "04:00"
open-pull-requests-limit: 5
commit-message:
prefix: "ci"

View File

@@ -8,4 +8,4 @@
"""Metadata for this python module."""
__version__ = "2025.5.20.7"
__version__ = "2025.6.6.4"

View File

@@ -106,7 +106,9 @@ DEPOSITS_HEADER_TEMPLATE = "invenio_theme_iform/header.html"
# SEARCH_UI_SEARCH_TEMPLATE = "invenio_theme_iform/search.html"
# """override the default search page"""
IFORM_ROUTES = {
THEME_IFORM_ROUTES = {
"index": "/",
"comingsoon": "/comingsoon",
"records-search": "/records/search",
"overview": "/me/overview",
}

View File

@@ -8,6 +8,7 @@
"""invenio module for I-Form theme."""
from flask import g, has_request_context
from flask_login import login_required
from invenio_records_marc21.ui.theme import current_identity_can_view
@@ -34,7 +35,16 @@ class InvenioThemeIform(object):
@app.context_processor
def inject_visibility():
return {"can_view_marc21": current_identity_can_view()}
def can_view_marc21():
try:
# Only check if we're in a request context and identity exists
if has_request_context() and hasattr(g, "identity") and g.identity:
return current_identity_can_view()
return False
except (AttributeError, RuntimeError):
return False
return {"can_view_marc21": can_view_marc21()}
app.extensions["invenio-theme-iform"] = self

View File

@@ -42,12 +42,12 @@
{%- if config.INVENIO_CONFIG_IFORM_SHIBBOLETH %}
<div class="ui divider"></div>
<a
href="{{ url_for("sso_saml.sso", idp="idp") }}"
href="{{ url_for('sso_saml.sso', idp='idp') }}"
class="login-page-button ui fluid large button"
>
<span style="font-size: 18px;">Sign up with I-Form</span>
<img
src="{{ url_for("static", filename=config.INVENIO_THEME_IFORM_ICON) }}"
src="{{ url_for('static', filename=config.INVENIO_THEME_IFORM_ICON) }}"
height="20px"
/>
</a>
@@ -73,7 +73,7 @@
<div class="content {{ accordion_active }}">
<form
class="ui large form"
action="{{ url_for_security("register") }}"
action="{{ url_for_security('register') }}"
method="POST"
name="register_user_form"
>

View File

@@ -36,7 +36,7 @@
{%- endblock head_title %}
{%- block head_links %}
<link rel="shortcut icon" href="{{ url_for("static", filename="favicon.ico") }}" />
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" />
{%- if keywords %}
<link rel="canonical" href="{{ canonical_url }}" />

View File

@@ -132,7 +132,7 @@
title="invenioRDM"
>
<img
src="{{ url_for("static", filename="images/inveniordm-tail.svg") }}"
src="{{ url_for('static', filename='images/inveniordm-tail.svg') }}"
alt="InvenioRDM logo"
style="display: block; height: 90px; margin-top: 8px;"
/>
@@ -148,7 +148,7 @@
title="Science Foundation Ireland"
>
<img
src="{{ url_for("static", filename="images/SFI_logo.png") }}"
src="{{ url_for('static', filename='images/SFI_logo.png') }}"
alt="Science Foundation Ireland"
style="display: block; height: auto; margin-top: 15px; width: 230px;"
/>

View File

@@ -64,7 +64,7 @@
<div class="affiliation-text">
<a
title="Home"
href="{{ url_for("invenio_theme_iform.index") }}"
href="{{ url_for('invenio_theme_iform.index') }}"
class="no-decoration"
>
I-FORM

View File

@@ -129,7 +129,7 @@
<img
width="400px"
alt="Publications"
src="{{ url_for('static', filename='images/library-book-svgrepo-com.svg') }}"
src="{{ url_for('invenio_theme_iform.static', filename='images/library-book-svgrepo-com.svg') }}"
/>
</a>
<div>Overview: Description for publications</div>

View File

@@ -8,10 +8,11 @@
"""invenio module for I-Form theme."""
import traceback
from functools import wraps
from typing import Dict
from flask import Blueprint, current_app, g, redirect, render_template, url_for
from flask import Blueprint, Flask, current_app, g, redirect, render_template, url_for
from flask_login import current_user, login_required
from invenio_rdm_records.proxies import current_rdm_records
from invenio_records_global_search.resources.serializers import (
@@ -22,15 +23,30 @@ from opensearch_dsl.utils import AttrDict
from .search import FrontpageRecordsSearch
blueprint = Blueprint(
"invenio_theme_iform",
__name__,
template_folder="templates",
static_folder="static",
)
def create_blueprint(app: Flask) -> Blueprint:
"""Create blueprint."""
blueprint = Blueprint(
"invenio_theme_iform",
__name__,
template_folder="templates",
static_folder="static",
)
routes = app.config.get("THEME_IFORM_ROUTES")
blueprint.add_url_rule(routes["records-search"], view_func=records_search)
blueprint.add_url_rule(routes["index"], view_func=index)
blueprint.add_url_rule(routes["overview"], view_func=overview)
# base case for any otherwise unhandled exception
app.register_error_handler(Exception, default_error_handler)
blueprint.add_app_template_filter(make_dict_like)
blueprint.add_app_template_filter(cast_to_dict)
return blueprint
@blueprint.route("/records/search")
def records_search():
"""Search page ui.
@@ -70,7 +86,6 @@ def require_iform_authenticated(view_func):
return decorated_view
@blueprint.route("/me/overview")
@login_required
def overview():
"""Overview."""
@@ -85,7 +100,6 @@ def overview():
)
@blueprint.app_template_filter("make_dict_like")
def make_dict_like(value: str, key: str) -> Dict[str, str]:
"""Convert the value to a dict like structure.
@@ -94,7 +108,6 @@ def make_dict_like(value: str, key: str) -> Dict[str, str]:
return {key: value}
@blueprint.app_template_filter("cast_to_dict")
def cast_to_dict(attr_dict):
"""Return the dict structure of AttrDict variable."""
return AttrDict.to_dict(attr_dict)
@@ -109,21 +122,13 @@ def default_error_handler(e: Exception):
# - `e`, the passed-in exception
# to get proxied-to objects: `flask.request._get_current_object()`
msg = f"default_error_handler of invenio-theme-iform captured following error type: {
type(e)
} with message {e} and stack trace {traceback.format_exc()}"
current_app.logger.error(msg)
return render_template(current_app.config["THEME_500_TEMPLATE"]), 500
def ui_blueprint(app):
"""Blueprint for the routes and resources provided by invenio-theme-iform."""
routes = app.config.get("IFORM_ROUTES")
blueprint.add_url_rule(routes["index"], view_func=index)
# base case for any otherwise unhandled exception
app.register_error_handler(Exception, default_error_handler)
return blueprint
def records_serializer(records=None):
"""Serialize list of records."""
serializer = GlobalSearchJSONSerializer()

View File

@@ -24,10 +24,10 @@ classifiers = [
requires-python = ">=3.10,<3.14"
dependencies = [
"invenio-assets>=2.0.0",
"invenio-i18n>=1.3.1",
"invenio-config-iform>=2025.5.20.1",
"invenio_records_global_search>=0.0.1",
"invenio_records_marc21>=0.21.0",
"invenio-records-lom>=0.16.0",
]
[project.urls]
@@ -43,10 +43,7 @@ test = "scripts.test:main"
invenio_theme_iform = "invenio_theme_iform:InvenioThemeIform"
[project.entry-points."invenio_base.blueprints"]
invenio_theme_iform = "invenio_theme_iform.views:ui_blueprint"
[project.entry-points."invenio_i18n.translations"]
messages = "invenio_theme_iform"
invenio_theme_iform = "invenio_theme_iform.views:create_blueprint"
[project.entry-points."invenio_assets.webpack"]
invenio_theme_iform_theme = "invenio_theme_iform.webpack:theme"

70
uv.lock generated
View File

@@ -1728,7 +1728,8 @@ dependencies = [
{ name = "flask-sqlalchemy" },
{ name = "invenio-base" },
{ name = "sqlalchemy", extra = ["asyncio"] },
{ name = "sqlalchemy-continuum" },
{ name = "sqlalchemy-continuum", version = "1.3.15", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
{ name = "sqlalchemy-continuum", version = "1.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
{ name = "sqlalchemy-utils" },
]
sdist = { url = "https://files.pythonhosted.org/packages/94/1f/542c73355a6c8f51b6c431676345797b669d749e63f5387d86a1f95f87ab/invenio-db-2.0.0.tar.gz", hash = "sha256:3f2dc12d95fc2febcc2b35cb3b4ec315dd9b3ec43b272a8028b8ba76a4167be3", size = 36105, upload_time = "2024-11-20T20:51:17.761Z" }
@@ -2131,6 +2132,43 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/86/7a/b6b5f0090761210805bc674632ff66e42ba4784c0449319fac6ae1719a81/invenio_records_global_search-0.3.3-py2.py3-none-any.whl", hash = "sha256:e8678a4e3fad1a82681bc15e4762fbceb4e3aab53754d18a1e4c857069074d5a", size = 63575, upload_time = "2025-01-24T11:58:11.709Z" },
]
[[package]]
name = "invenio-records-lom"
version = "0.16.0"
source = { registry = "https://pypi.org/simple" }
resolution-markers = [
"python_full_version == '3.11.*'",
"python_full_version < '3.11'",
]
dependencies = [
{ name = "invenio-previewer", marker = "python_full_version < '3.12'" },
{ name = "invenio-rdm-records", marker = "python_full_version < '3.12'" },
{ name = "invenio-stats", marker = "python_full_version < '3.12'" },
{ name = "sqlalchemy-continuum", version = "1.3.15", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/f6/93/0bde36eb294215b16f00878bfece8f228eb9e3aa118481444961cb1e1ce9/invenio-records-lom-0.16.0.tar.gz", hash = "sha256:9eb34beb34e8b0aabee90c5af1e9447676d81047f6d96395f455b84397f426c3", size = 172143, upload_time = "2024-07-05T08:56:11.593Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/ef/3e/518fa9a33c999161fe8a607f6fbd3a620091fb3bb2f6303611395f3f13de/invenio_records_lom-0.16.0-py2.py3-none-any.whl", hash = "sha256:4a9d3fd07e2b1816ed7c196b72cf6f836d66e319d12533bcbcb377730bc6940d", size = 219584, upload_time = "2024-07-05T08:56:09.7Z" },
]
[[package]]
name = "invenio-records-lom"
version = "0.18.4"
source = { registry = "https://pypi.org/simple" }
resolution-markers = [
"python_full_version >= '3.12'",
]
dependencies = [
{ name = "invenio-previewer", marker = "python_full_version >= '3.12'" },
{ name = "invenio-rdm-records", marker = "python_full_version >= '3.12'" },
{ name = "invenio-stats", marker = "python_full_version >= '3.12'" },
{ name = "marshmallow", marker = "python_full_version >= '3.12'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/f8/e2/34683c23ce657b7df4aea1ad2be50d8565aa3407dd00f4227e773c7f1948/invenio_records_lom-0.18.4.tar.gz", hash = "sha256:87949eacf32f7917055e46debe39fb46f85b442da11f89435f45a361f694f650", size = 180272, upload_time = "2025-06-06T09:22:37.648Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/15/07/3ee50b4c0b48e597615cb6416cae95f5f58f26c89c73a7736d14a104ba8c/invenio_records_lom-0.18.4-py2.py3-none-any.whl", hash = "sha256:eb8922fbde403b8125d8b9c793343931573d05a3c1b5e7a5e401e7d7f788dd55", size = 237734, upload_time = "2025-06-06T09:22:35.957Z" },
]
[[package]]
name = "invenio-records-marc21"
version = "0.22.2"
@@ -2353,9 +2391,10 @@ source = { editable = "." }
dependencies = [
{ name = "invenio-assets" },
{ name = "invenio-config-iform" },
{ name = "invenio-i18n" },
{ name = "invenio-records-global-search", version = "0.2.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
{ name = "invenio-records-global-search", version = "0.3.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
{ name = "invenio-records-lom", version = "0.16.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
{ name = "invenio-records-lom", version = "0.18.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
{ name = "invenio-records-marc21", version = "0.22.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
{ name = "invenio-records-marc21", version = "0.24.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
]
@@ -2388,8 +2427,8 @@ tests = [
requires-dist = [
{ name = "invenio-assets", specifier = ">=2.0.0" },
{ name = "invenio-config-iform", specifier = ">=2025.5.20.1" },
{ name = "invenio-i18n", specifier = ">=1.3.1" },
{ name = "invenio-records-global-search", specifier = ">=0.0.1" },
{ name = "invenio-records-lom", specifier = ">=0.16.0" },
{ name = "invenio-records-marc21", specifier = ">=0.21.0" },
]
@@ -4750,13 +4789,34 @@ asyncio = [
{ name = "greenlet" },
]
[[package]]
name = "sqlalchemy-continuum"
version = "1.3.15"
source = { registry = "https://pypi.org/simple" }
resolution-markers = [
"python_full_version == '3.11.*'",
"python_full_version < '3.11'",
]
dependencies = [
{ name = "six", marker = "python_full_version < '3.12'" },
{ name = "sqlalchemy", marker = "python_full_version < '3.12'" },
{ name = "sqlalchemy-utils", marker = "python_full_version < '3.12'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/cb/cf/4b21e74aff8ec06c362e043db3bb63bdb16ff0e5b5bbe21064fd0651a78b/SQLAlchemy-Continuum-1.3.15.tar.gz", hash = "sha256:a52689d1580daabc496ca8420fa742d62b371bc43921d6c06374192e52e0c409", size = 81279, upload_time = "2023-06-07T01:30:37.9Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/2f/02/581778b566128ea1d6e9e5f1fc833ff47d798cc5a393c0709f74639fb9de/SQLAlchemy_Continuum-1.3.15-py3-none-any.whl", hash = "sha256:d2ecc798500f5d5195ecd2143f7d1eabb0aa46e0f213e38bfeb4331d25cc08d3", size = 45736, upload_time = "2023-06-07T01:30:35.925Z" },
]
[[package]]
name = "sqlalchemy-continuum"
version = "1.4.2"
source = { registry = "https://pypi.org/simple" }
resolution-markers = [
"python_full_version >= '3.12'",
]
dependencies = [
{ name = "sqlalchemy" },
{ name = "sqlalchemy-utils" },
{ name = "sqlalchemy", marker = "python_full_version >= '3.12'" },
{ name = "sqlalchemy-utils", marker = "python_full_version >= '3.12'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/05/81/76e0b16ca8575463ba83e014afe8a89443bbc6a896dad3c48068ce571611/sqlalchemy_continuum-1.4.2.tar.gz", hash = "sha256:0fd2be79f718eda47c2206879d92ec4ebf1889364637b3caf3ee5d34bd19c8e3", size = 81713, upload_time = "2024-05-02T20:03:43.192Z" }
wheels = [