mirror of
https://github.com/Cian-H/invenio-theme-iform.git
synced 2025-12-22 12:41:57 +00:00
Attempt to fix loading issues when oauth is not responding
This commit is contained in:
@@ -8,4 +8,4 @@
|
||||
|
||||
"""Metadata for this python module."""
|
||||
|
||||
__version__ = "2025.5.20.8"
|
||||
__version__ = "2025.6.3"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user