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/24 22:00:46 UTC

svn commit: r1668991 - /steve/trunk/pysteve/lib/plugins/yna.py

Author: humbedooh
Date: Tue Mar 24 21:00:46 2015
New Revision: 1668991

URL: http://svn.apache.org/r1668991
Log:
simplify check

Modified:
    steve/trunk/pysteve/lib/plugins/yna.py

Modified: steve/trunk/pysteve/lib/plugins/yna.py
URL: http://svn.apache.org/viewvc/steve/trunk/pysteve/lib/plugins/yna.py?rev=1668991&r1=1668990&r2=1668991&view=diff
==============================================================================
--- steve/trunk/pysteve/lib/plugins/yna.py (original)
+++ steve/trunk/pysteve/lib/plugins/yna.py Tue Mar 24 21:00:46 2015
@@ -41,12 +41,8 @@ def tallyYNA(votes, issue):
 def validateYNA(vote, issue):
     "Tries to invalidate a vote, returns why if succeeded, None otherwise"
     letters = ['y','n','a']
-    for char in letters:
-        if vote.count(char) > 1:
-            return "Duplicate letters found"
-    for char in vote:
-        if char not in letters:
-            return "Invalid characters in vote. Accepted are: %s" % ", ".join(letters)
+    if len(vote) != 1 or not vote in letters:
+        return "Invalid vote. Accepted votes are: %s" % ", ".join(letters)
     return None
 
 constants.VOTE_TYPES += (