def __hts_vote(self, valid_person, vote, votebox): import vote_analyzer ik = valid_person[0] evlog.log_integrity(vote_analyzer.analyze(ik, vote, votebox)) res_ok, res = self.__hes.hts_vote(valid_person, vote) if res_ok == evcommon.EVOTE_OK: return protocol.msg_ok(res) else: return self.__return_error(res_ok, res)
def __hts_vote(self, valid_person, vote, votebox): if self.__use_ctx: sess_ok, sess_msg = self.ctx().check_session(client_cert()) if not sess_ok == evcommon.EVOTE_OK: return self.__return_error(sess_ok, sess_msg) import vote_analyzer ik = valid_person[0] evlog.log_integrity(vote_analyzer.analyze(ik, vote, votebox)) res_ok, res = self.__hes.hts_vote(valid_person, vote) if res_ok == evcommon.EVOTE_OK: if self.__use_ctx: self.ctx().kill() return protocol.msg_ok(res) else: return self.__return_error(res_ok, res)
def __get_candidate_list(self, valid_person): cand_ok, cand_msg = self.__hes.get_candidate_list(valid_person) if not cand_ok == evcommon.EVOTE_OK: return self.__return_error(cand_ok, cand_msg) korduv_ret, korduv_msg = self.__hes.hts_repeat_check(valid_person) if korduv_ret == evcommon.EVOTE_REPEAT_NO: return protocol.msg_ok(cand_msg) elif korduv_ret == evcommon.EVOTE_REPEAT_YES: return protocol.msg_repeat(cand_msg, korduv_msg) elif korduv_ret == evcommon.EVOTE_REPEAT_NOT_CONSISTENT: r1, r2 = protocol.plain_error_maintainance() return self.__return_error(r1, r2) else: return self.__return_error(evcommon.EVOTE_ERROR, korduv_msg)
def __get_candidate_list(self, valid_person): cand_ok, cand_msg = self.__hes.get_candidate_list(valid_person) if not cand_ok == evcommon.EVOTE_OK: return self.__return_error(cand_ok, cand_msg) korduv_ret, korduv_msg = self.__hes.hts_repeat_check(valid_person) if korduv_ret == evcommon.EVOTE_REPEAT_NO: evlog.log('Kandidaatide nimekiri väljastati A') if self.__use_ctx: self.ctx().store_session(client_cert()) return protocol.msg_ok(cand_msg) elif korduv_ret == evcommon.EVOTE_REPEAT_YES: evlog.log('Kandidaatide nimekiri väljastati B') if self.__use_ctx: self.ctx().store_session(client_cert()) return protocol.msg_repeat(cand_msg, korduv_msg) elif korduv_ret == evcommon.EVOTE_REPEAT_NOT_CONSISTENT: r1, r2 = protocol.plain_error_maintainance() return self.__return_error(r1, r2) else: return self.__return_error(evcommon.EVOTE_ERROR, korduv_msg)