val_sha = form.getvalue(evcommon.POST_VOTERS_FILES_SHA1) if (not has_code) and (not has_vote): msg = htsalldisp.consistency(val_sha) protocol.http_response(msg) cgi.sys.exit(0) if (has_sess): sessionid.setsid(form.getvalue(evcommon.POST_SESS_ID)) if has_code and has_vote: if (has_sess): val_code = form.getvalue(evcommon.POST_PERSONAL_CODE) val_vote = form.getvalue(evcommon.POST_EVOTE) msg = htsalldisp.store_vote(val_sha, val_code, val_vote) protocol.http_response(msg) cgi.sys.exit(0) else: bad_input() if has_code and (not has_vote): if (has_sess): val_code = form.getvalue(evcommon.POST_PERSONAL_CODE) msg = htsalldisp.check_repeat(val_sha, val_code) protocol.http_response(msg) cgi.sys.exit(0) else: bad_input() bad_input()
val_sha = form.getvalue(evcommon.POST_VOTERS_FILES_SHA256) if (not has_code) and (not has_vote): msg = htsalldisp.consistency(val_sha) protocol.http_response(msg) cgi.sys.exit(0) if (has_sess): sessionid.setsid(form.getvalue(evcommon.POST_SESS_ID)) if has_code and has_vote: if (has_sess): val_code = form.getvalue(evcommon.POST_PERSONAL_CODE) val_vote = form.getvalue(evcommon.POST_EVOTE) msg = htsalldisp.store_vote(val_sha, val_code, val_vote) protocol.http_response(msg) cgi.sys.exit(0) else: bad_input() if has_code and (not has_vote): if (has_sess): val_code = form.getvalue(evcommon.POST_PERSONAL_CODE) msg = htsalldisp.check_repeat(val_sha, val_code) protocol.http_response(msg) cgi.sys.exit(0) else: bad_input() bad_input()
try: if cgivalidator.validate_sessionid(form): sessionid.setsid(form.getvalue(evcommon.POST_SESS_ID)) if evcommon.POST_EVOTE in form: # Store the vote req_params = [evcommon.POST_VOTERS_FILES_SHA256, evcommon.POST_SESS_ID, evcommon.POST_PERSONAL_CODE, evcommon.POST_EVOTE] res, logline = cgivalidator.validate_form(form, req_params) if res: sha = form.getvalue(evcommon.POST_VOTERS_FILES_SHA256) code = form.getvalue(evcommon.POST_PERSONAL_CODE) vote = form.getvalue(evcommon.POST_EVOTE) result = htsalldisp.store_vote(sha, code, vote) else: evlog.log_error("vote/err, " + logline) elif (evcommon.POST_SESS_ID in form or evcommon.POST_PERSONAL_CODE in form): # Check for repeat voting req_params = [evcommon.POST_VOTERS_FILES_SHA256, evcommon.POST_SESS_ID, evcommon.POST_PERSONAL_CODE] res, logline = cgivalidator.validate_form(form, req_params) if res: sha = form.getvalue(evcommon.POST_VOTERS_FILES_SHA256) code = form.getvalue(evcommon.POST_PERSONAL_CODE) result = htsalldisp.check_repeat(sha, code) else:
try: if cgivalidator.validate_sessionid(form): sessionid.setsid(form.getvalue(evcommon.POST_SESS_ID)) if evcommon.POST_EVOTE in form: # Store the vote req_params = [ evcommon.POST_VOTERS_FILES_SHA256, evcommon.POST_SESS_ID, evcommon.POST_PERSONAL_CODE, evcommon.POST_EVOTE ] res, logline = cgivalidator.validate_form(form, req_params) if res: sha = form.getvalue(evcommon.POST_VOTERS_FILES_SHA256) code = form.getvalue(evcommon.POST_PERSONAL_CODE) vote = form.getvalue(evcommon.POST_EVOTE) result = htsalldisp.store_vote(sha, code, vote) else: evlog.log_error("vote/err, " + logline) elif (evcommon.POST_SESS_ID in form or evcommon.POST_PERSONAL_CODE in form): # Check for repeat voting req_params = [ evcommon.POST_VOTERS_FILES_SHA256, evcommon.POST_SESS_ID, evcommon.POST_PERSONAL_CODE ] res, logline = cgivalidator.validate_form(form, req_params) if res: sha = form.getvalue(evcommon.POST_VOTERS_FILES_SHA256) code = form.getvalue(evcommon.POST_PERSONAL_CODE) result = htsalldisp.check_repeat(sha, code)