Example #1
0
    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()

# vim:set ts=4 sw=4 et fileencoding=utf8:
Example #2
0
        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()


# vim:set ts=4 sw=4 et fileencoding=utf8:
Example #3
0
                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:
                evlog.log_error("repeat/err, " + logline)

        else:
            # Check consistency
            req_params = [evcommon.POST_VOTERS_FILES_SHA256]
            res, logline = cgivalidator.validate_form(form, req_params)
            if res:
                sha = form.getvalue(evcommon.POST_VOTERS_FILES_SHA256)
                result = htsalldisp.consistency(sha)
            else:
                evlog.log_error("consistency/err, " + logline)
    except:
        evlog.log_exception()
        result = protocol.msg_error_technical()
Example #4
0
                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:
                evlog.log_error("repeat/err, " + logline)

        else:
            # Check consistency
            req_params = [evcommon.POST_VOTERS_FILES_SHA256]
            res, logline = cgivalidator.validate_form(form, req_params)
            if res:
                sha = form.getvalue(evcommon.POST_VOTERS_FILES_SHA256)
                result = htsalldisp.consistency(sha)
            else:
                evlog.log_error("consistency/err, " + logline)
    except:
        evlog.log_exception()
        result = protocol.msg_error_technical()