cleverking / django-voting

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

get_scores_in_bulk breaks when objects is empty #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
>>> from voting.models import Vote
>>> Vote.objects.get_scores_in_bulk([])

What is the expected output? What do you see instead?
Expected:
{}
Actual:
IndexError: list index out of range

What version of the product are you using? On what operating system?
trunk

Please provide any additional information below.
On line 43 of managers.py, the code assumes that there's an object at index
0, which isn't necessarily true.  I've attached a patch which rewrites the
get_scores_in_bulk method in the model of the get_for_user_in_bulk model.

Original issue reported on code.google.com by sco...@gmail.com on 5 Nov 2007 at 9:44

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in revision 60 - thanks!

Original comment by jonathan.buchanan on 6 Nov 2007 at 1:55