Skip to content

Error while slicing PaginatedList with few items #39

@citaret

Description

@citaret

This will not happen while there are hundreds of items.

In [230]: g1 = client.linode.get_instances(linode.Linode.group == "xxx")

In [231]: g1[0]
Out[231]: Linode: 3524678

In [232]: g1[1]
Out[232]: Linode: 3524954

In [233]: g1[:]
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-233-528aa4d21326> in <module>()
----> 1 g1[:]

~/.virtualenvs/vpn3/lib/python3.6/site-packages/linode/util/paginated_list.py in __getitem__(self, index)
     47         # this comes in here now, but we're hadling it elsewhere
     48         if isinstance(index, slice):
---> 49             return self._get_slice(index)
     50
     51         # handle negative indexing

~/.virtualenvs/vpn3/lib/python3.6/site-packages/linode/util/paginated_list.py in _get_slice(self, s)
    106         if not self.lists[i_page]:
    107             self._load_page(i_page)
--> 108         if not self.lists[j_page]:
    109             self._load_page(j_page)
    110

IndexError: list index out of range

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions