[Oi-commits] r1502 - trunk/forum
oi-commits at pardus.org.tr
oi-commits at pardus.org.tr
Thu Jun 19 17:56:03 EEST 2008
Author: jnmbk
Date: Thu Jun 19 17:56:02 2008
New Revision: 1502
Modified:
trunk/forum/views.py
Log:
prevent possible explosions :D
Modified: trunk/forum/views.py
=================================================================
--- trunk/forum/views.py (original)
+++ trunk/forum/views.py Thu Jun 19 17:56:02 2008
@@ -22,7 +22,7 @@
from oi.forum import customgeneric
from django.core.urlresolvers import reverse
-from django.core.exceptions import ObjectDoesNotExist
+from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.core.mail import send_mail
from oi.st.models import Tag, News
from oi.poll.models import Poll, PollOption, PollVote
@@ -937,6 +937,9 @@
vote.save()
option.vote_count = option.pollvote_set.count()
option.save()
+ except MultipleObjectsReturned:
+ # This is not supposed to happen, but let's take cover
+ PollVote.objects.filter(poll=poll, voter=request.user)[0].delete()
return HttpResponseRedirect(topic.get_absolute_url())
More information about the Oi-commits
mailing list