Skip to content

Commit

Permalink
Disallow negative time extension
Browse files Browse the repository at this point in the history
Otherwise anyone can just end a vote.
  • Loading branch information
rmorell committed May 22, 2012
1 parent 8eefe5a commit 77104ea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ def register_vote(self,choice,member=None):
return was_changed

def extend_duration(self,hours):
if hours <= 0:
logging.info('Member %s attempted to extend negative time' %
(member.nickname(),users.get_current_user()))
raise Exception('Negative extensions are not valid.')
self.duration += hours
if self.start_time:
self.end_time = self.start_time + timedelta(hours=self.duration)
Expand Down

0 comments on commit 77104ea

Please sign in to comment.