Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

A few more... #3

Merged
merged 3 commits into from

2 participants

@rmorell

The first two are pretty critical, the last one less so

rmorell added some commits
@rmorell rmorell Disallow extending time on closed polls
Otherwise you can reopen a closed poll and change the result.
c53ed78
@rmorell rmorell Disallow voting in closed polls 5782599
@rmorell rmorell Update status when querying
Otherwise the status is only updated when the issues page is viewed.
This fixes a race condition where the issue may have been closed but the
status won't reflect that and may still allow updates.
960ad87
@dustball dustball merged commit 2bf4573 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 22, 2012
  1. @rmorell

    Disallow extending time on closed polls

    rmorell authored
    Otherwise you can reopen a closed poll and change the result.
  2. @rmorell
  3. @rmorell

    Update status when querying

    rmorell authored
    Otherwise the status is only updated when the issues page is viewed.
    This fixes a race condition where the issue may have been closed but the
    status won't reflect that and may still allow updates.
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 models.py
View
6 models.py
@@ -40,6 +40,8 @@ def vote_for_member(self,member=None):
return self.votes.filter('member =',member).get()
def register_vote(self,choice,member=None):
+ if self.has_results:
+ raise Exception('Cannot vote in closed polls.')
if not member:
member = users.get_current_user()
member_vote = self.vote_for_member(member)
@@ -59,6 +61,8 @@ def register_vote(self,choice,member=None):
def extend_duration(self,hours):
if hours <= 0:
raise Exception('Negative extensions are not valid.')
+ if self.has_results:
+ raise Exception('Cannot extend closed polls.')
self.duration += hours
if self.start_time:
self.end_time = self.start_time + timedelta(hours=self.duration)
@@ -76,9 +80,11 @@ def hours_left(self):
return hours
def is_active(self):
+ self.update_status()
return self.status in ('active')
def has_results(self):
+ self.update_status()
return self.status in ('done')
def member_is_creator(self,member=None):
Something went wrong with that request. Please try again.