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
This commit is contained in:
Petr Malik 2016-08-31 18:12:49 -04:00
parent 4512aec2d4
commit 4b6285f702
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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: