From 4b6285f702ab70391fbd43254cae05787cdc7509 Mon Sep 17 00:00:00 2001 From: Petr Malik Date: Wed, 31 Aug 2016 18:12:49 -0400 Subject: [PATCH] Port pagination on Python 3 Use an empty string rather None as marker for bisect. On Python 3, a comparison between None and strings now raises a TypeError. Partially implements: blueprint trove-python3 Change-Id: Iaefc20bd1cc980732e0c8a075e570958335c17e1 --- blacklist-py3.txt | 2 -- trove/common/pagination.py | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blacklist-py3.txt b/blacklist-py3.txt index ad96f260f7..ba62333b11 100644 --- a/blacklist-py3.txt +++ b/blacklist-py3.txt @@ -1,6 +1,4 @@ # Use a blacklist of tests known to fail on Python 3, until # all unit tests will pass on Python 3. -guestagent.test_cassandra_manager -guestagent.test_mongodb_manager guestagent.test_operating_system guestagent.test_volume diff --git a/trove/common/pagination.py b/trove/common/pagination.py index c1bc9ef56c..7e45d86fb0 100644 --- a/trove/common/pagination.py +++ b/trove/common/pagination.py @@ -37,6 +37,8 @@ def paginate_list(li, limit=None, marker=None, include_marker=False, """ sli = sorted(li, key=key) index = [key(item) for item in sli] + if marker is None: + marker = '' if include_marker: pos = bisect.bisect_left(index, marker) else: