Skip to content

Commit

Permalink
model: make forward compatible to sqlalchemy >= 2
Browse files Browse the repository at this point in the history
  • Loading branch information
utnapischtim committed Oct 8, 2024
1 parent 9d0f8ab commit 17fac2d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion invenio_access/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# This file is part of Invenio.
# Copyright (C) 2015-2023 CERN.
# Copyright (C) 2024 Graz University of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down Expand Up @@ -80,7 +81,7 @@ def query_by_action(cls, action, argument=None):
set as ``None``. (Default: ``None``)
:returns: A query object.
"""
query = cls.query.filter_by(action=action.value)
query = db.session.query(cls).filter_by(action=action.value)
argument = argument or getattr(action, "argument", None)
if argument is not None:
query = query.filter(
Expand Down

0 comments on commit 17fac2d

Please sign in to comment.