xgate1 / pylast

Automatically exported from code.google.com/p/pylast
Apache License 2.0
0 stars 0 forks source link

Library get_albums returns an empty list when limit param is None #63

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
>>> albums = lib.get_albums(limit=100)
>>> print albums[0]
LibraryItem(item=pylast.Album(u'Air', u'Talkie Walkie', (...) )
>>> albums = lib.get_albums(limit=None)
>>> print albums[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: list index out of range

pylast: r255
python: 2.6.6

Every function that uses _collect_nodes function with limit parameter set to 
None has the same issue. When limit is set to None line 3526 is always False.

3526: if not node.nodeType == xml.dom.Node.TEXT_NODE and len(nodes) < limit:

Suggestion:
3526: if not node.nodeType == xml.dom.Node.TEXT_NODE and (not limit or 
len(nodes) < limit):

Original issue reported on code.google.com by grzegorz...@gmail.com on 19 Mar 2011 at 7:32

GoogleCodeExporter commented 8 years ago
Fixed in my fork:
https://github.com/hugovk/pylast/issues/64

Original comment by hugovk@gmail.com on 1 Mar 2014 at 2:29