google-code-export / django-syncr

Automatically exported from code.google.com/p/django-syncr
0 stars 0 forks source link

Readernaut: Single book result page breaks readernautsyncr #42

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In syncr.app.syncreadernaut.py:

If XML2Dict parses a Readernaut-API-page with only one book in it - for
example the third page of an Readernaut-accout with 21 Books -
r1["reader_books"]["reader_book"] doesn't contain a list but but a dictionary. 

Code breaks in line 24 of syncreadernaut.py in syncbooks.

Changing line 22 
  for book in r1["reader_books"]["reader_book"]:
to 
  for i in r1["reader_books"]["reader_book"] if
r1["reader_books"]["reader_book"].__class__.__name__ == 'list' else
[r1["reader_books"]["reader_book"]]:

should fix it by turning putting the single object in a list. 

I hope this is understandable. 

Great Job with django-syncr, btw. 

Original issue reported on code.google.com by kioopi on 15 Feb 2009 at 7:02

GoogleCodeExporter commented 9 years ago
Nice catch. I have tested it with 2 accounts and both the accounts seems to 
have quite some books. thanks 
anyway. I will handle this scenario in my next commit.

Original comment by yash...@gmail.com on 4 Mar 2009 at 1:07