Author: humbedooh
Date: Wed Mar 25 02:19:26 2015
New Revision: 1669045
URL: http://svn.apache.org/r1669045
Log:
lurk on who voted (not what they voted, but whether they voted!) if 'lurk' is
set to 'yes' in steve.cfg
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=1669045&r1=1669044&r2=1669045&view=diff
==============================================================================
--- steve/trunk/pysteve/lib/election.py (original)
+++ steve/trunk/pysteve/lib/election.py Wed Mar 25 02:19:26 2015
@@ -22,7 +22,7 @@ import time
from __main__ import homedir, config
-import constants
+import constants, voter
from plugins import *
def exists(election, *issue):
@@ -152,6 +152,20 @@ def vote(electionID, issueID, voterID, v
f.write(json.dumps(votes))
f.close()
votehash = hashlib.sha224(basedata['hash'] + issueID + voterID +
vote).hexdigest()
+
+ # LURK on who voted :O :O :O
+ if config.has_option("general", "lurk") and config.get("general",
"lurk") == "yes":
+ email = voter.get(electionID, basedata, voterID)
+ lurks = {}
+ lurkpath = os.path.join(homedir, "issues", electionID, "who.voted")
+ if os.path.isfile(lurkpath):
+ with open(lurkpath, "r") as f:
+ lurks = json.loads(f.read())
+ f.close()
+ lurks[email] = True
+ with open(lurkpath, "w") as f:
+ f.write(json.dumps(lurks))
+ f.close()
return votehash
else:
raise Exception("No such election")