From 7450325655238f1066107e1f86d1a4b3f88f64ba Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Mon, 23 Sep 2024 22:58:27 +0200 Subject: [PATCH] fix: add compatibility layer to move to flask>=3 * flask-sqlalchemy moved pagination. * this change has been added to have a smooth migration to flask>=3.0.0 without creating a hard cut and major versions release. --- invenio_banners/services/results.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/invenio_banners/services/results.py b/invenio_banners/services/results.py index 929ce93..f04d2d7 100644 --- a/invenio_banners/services/results.py +++ b/invenio_banners/services/results.py @@ -1,14 +1,22 @@ # -*- coding: utf-8 -*- # # Copyright (C) 2022-2023 CERN. +# Copyright (C) 2024 Graz University of Technology. # # Invenio-Banners is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Service results.""" -from flask_sqlalchemy import Pagination + from invenio_records_resources.services.records.results import RecordItem, RecordList +try: + # flask_sqlalchemy<3.0.0 + from flask_sqlalchemy import Pagination +except ImportError: + # flask_sqlalchemy>=3.0.0 + from flask_sqlalchemy.pagination import Pagination + class BannerItem(RecordItem): """Single banner result."""