import htsalldisp import cgi import evcommon import protocol import sessionid import os def bad_input(): _msg = htsalldisp.bad_cgi_input() protocol.http_response(_msg) cgi.sys.exit(0) if not evcommon.testrun(): os.umask(007) form = cgi.FieldStorage() has_sha1 = form.has_key(evcommon.POST_VOTERS_FILES_SHA1) has_code = form.has_key(evcommon.POST_PERSONAL_CODE) has_vote = form.has_key(evcommon.POST_EVOTE) has_sess = form.has_key(evcommon.POST_SESS_ID) if (not has_sha1): bad_input() val_sha = form.getvalue(evcommon.POST_VOTERS_FILES_SHA1) if (not has_code) and (not has_vote): msg = htsalldisp.consistency(val_sha)
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/. """ import cgi import evcommon import middisp import protocol import evlog import sessionid import cgivalidator import cgilog import election import os if not evcommon.testrun(): os.umask(007) form = cgi.FieldStorage() result = protocol.msg_error_technical() mid = middisp.MIDDispatcher() evlog.AppLog().set_app('MID') try: has_sess = form.has_key(evcommon.POST_SESS_ID) has_poll = form.has_key(evcommon.POST_MID_POLL) if has_sess: if cgivalidator.validate_sessionid(form): sessionid.setsid(form.getvalue(evcommon.POST_SESS_ID)) if has_poll: req_params = [evcommon.POST_MID_POLL, evcommon.POST_SESS_ID] res, logline = cgivalidator.validate_form(form, req_params)