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/27 21:39:50 UTC

svn commit: r1669679 - /steve/trunk/pysteve/lib/election.py

Author: humbedooh
Date: Fri Mar 27 20:39:49 2015
New Revision: 1669679

URL: http://svn.apache.org/r1669679
Log:
es.get will error out if the election/issue does not exist, so capture that and just return False

Modified:
    steve/trunk/pysteve/lib/election.py

Modified: steve/trunk/pysteve/lib/election.py
URL: http://svn.apache.org/viewvc/steve/trunk/pysteve/lib/election.py?rev=1669679&r1=1669678&r2=1669679&view=diff
==============================================================================
--- steve/trunk/pysteve/lib/election.py (original)
+++ steve/trunk/pysteve/lib/election.py Fri Mar 27 20:39:49 2015
@@ -64,11 +64,14 @@ def exists(election, *issue):
         if issue and issue[0]:
             doc = "issues"
             eid = hashlib.sha224(electionID + "/" + issueID).hexdigest()
-        res = es.get(index="steve", doc_type=doc, id=eid)
-        if res:
-            return True
-        else:
-            return False
+        try:
+            res = es.get(index="steve", doc_type=doc, id=eid)
+            if res:
+                return True
+            else:
+                return False
+        except:
+            return False # ES Transport error, assume no such issue
 
 def getBasedata(election, hideHash=False):
     "Get base data from an election"