Merge "Port pagination on Python 3"

This commit is contained in:
Jenkins 2016-09-08 10:27:49 +00:00 committed by Gerrit Code Review
commit 7c46c3734d
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 # Use a blacklist of tests known to fail on Python 3, until
# all unit tests will pass on Python 3. # all unit tests will pass on Python 3.
guestagent.test_cassandra_manager
guestagent.test_mongodb_manager
guestagent.test_operating_system guestagent.test_operating_system
guestagent.test_volume 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) sli = sorted(li, key=key)
index = [key(item) for item in sli] index = [key(item) for item in sli]
if marker is None:
marker = ''
if include_marker: if include_marker:
pos = bisect.bisect_left(index, marker) pos = bisect.bisect_left(index, marker)
else: else: