Permalink
Browse files

Disallow negative time extension

Otherwise anyone can just end a vote.
  • Loading branch information...
1 parent 8eefe5a commit 77104eadd7af04616a38e2908950eacb5509933d @rmorell committed May 22, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 models.py
View
@@ -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)

0 comments on commit 77104ea

Please sign in to comment.