From 250fa696a077066d32420e2190a5efabb6fc5d05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= Date: Tue, 29 Jun 2021 16:49:41 +0200 Subject: [PATCH 1/2] Restrict sanic version to avoid breaking tests with v21 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e3dd252..e90e923 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ 'flask', 'flask-sqlalchemy', 'tornado', - 'sanic', + 'sanic<21', 'aiohttp', 'pyyaml', ] From 21dd8ecb288571e6fb08e623cc275abc6a33c86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= Date: Wed, 30 Jun 2021 14:54:13 +0200 Subject: [PATCH 2/2] Fix retrieving offset and limit values with SQLAlchemy 1.4 --- unrest/rest.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unrest/rest.py b/unrest/rest.py index ba2dfdc..aaf2306 100644 --- a/unrest/rest.py +++ b/unrest/rest.py @@ -526,10 +526,10 @@ def serialize_all(self, items): if isinstance(items, Query): rv['occurences'] = items.offset(None).limit(None).count() - if items._offset is not None: - rv['offset'] = items._offset - if items._limit is not None: - rv['limit'] = items._limit + if items.selectable._offset is not None: + rv['offset'] = items.selectable._offset + if items.selectable._limit is not None: + rv['limit'] = items.selectable._limit rv['objects'] = [self.serialize(item) for item in items] if 'occurences' not in rv: