You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@steve.apache.org by hu...@apache.org on 2015/03/26 12:42:33 UTC
svn commit: r1669329 - in /steve/trunk/pysteve/lib/plugins: ap.py yna.py
Author: humbedooh
Date: Thu Mar 26 11:42:33 2015
New Revision: 1669329
URL: http://svn.apache.org/r1669329
Log:
use elifs and raise a bork if invalid vote found
Modified:
steve/trunk/pysteve/lib/plugins/ap.py
steve/trunk/pysteve/lib/plugins/yna.py
Modified: steve/trunk/pysteve/lib/plugins/ap.py
URL: http://svn.apache.org/viewvc/steve/trunk/pysteve/lib/plugins/ap.py?rev=1669329&r1=1669328&r2=1669329&view=diff
==============================================================================
--- steve/trunk/pysteve/lib/plugins/ap.py (original)
+++ steve/trunk/pysteve/lib/plugins/ap.py Thu Mar 26 11:42:33 2015
@@ -27,14 +27,16 @@ def tallyAP(votes, issue):
for vote in votes.values():
if vote == 'y':
y += 1
- if vote == 'n':
+ elif vote == 'n':
n += 1
- if vote == 'a':
+ elif vote == 'a':
a += 1
- if vote == 'by':
+ elif vote == 'by':
by += 1
- if vote == 'bn':
+ elif vote == 'bn':
bn += 1
+ else:
+ raise Exception("Invalid vote found in votes db!")
return {
'votes': len(votes),
Modified: steve/trunk/pysteve/lib/plugins/yna.py
URL: http://svn.apache.org/viewvc/steve/trunk/pysteve/lib/plugins/yna.py?rev=1669329&r1=1669328&r2=1669329&view=diff
==============================================================================
--- steve/trunk/pysteve/lib/plugins/yna.py (original)
+++ steve/trunk/pysteve/lib/plugins/yna.py Thu Mar 26 11:42:33 2015
@@ -26,10 +26,12 @@ def tallyYNA(votes, issue):
for vote in votes.values():
if vote == 'y':
y += 1
- if vote == 'n':
+ elif vote == 'n':
n += 1
- if vote == 'a':
+ elif vote == 'a':
a += 1
+ else:
+ raise Exception("Invalid vote found!")
return {
'votes': len(votes),