in pysteve/lib/election.py [0:0]
def vote(electionID, issueID, voterID, vote):
"Casts a vote on an issue"
basedata = getBasedata(electionID)
issueData = getIssue(electionID, issueID)
if basedata and issueData:
xhash = constants.hexdigest(electionID + ":" + voterID)
vhash = constants.hexdigest(xhash + issueID)
votehash = constants.hexdigest(basedata['hash'] + issueID + voterID + vote)
# Vote verification
voteType = getVoteType(issueData)
if voteType.get('vote_func'):
# This will/should raise an exception if the vote is invalid
uid = voter.get(electionID, basedata, voterID)
voteType['vote_func'](basedata, issueID, voterID, vote, uid)
backend.vote(electionID, issueID, voterID, vote, vhash = vhash)
# 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)
# backend['lurk'](electionID, email)
return votehash
else:
raise Exception("No such election")