From d0c332a64932cb21d139f860e597fcc42d30ff74 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Tue, 8 Oct 2024 23:15:18 +0200 Subject: [PATCH] model: make forward compatible to sqlalchemy >= 2 --- invenio_access/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/invenio_access/models.py b/invenio_access/models.py index 46eec89..ea70e86 100644 --- a/invenio_access/models.py +++ b/invenio_access/models.py @@ -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. @@ -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(