def get_vote_for_result(self, logline, fname): res = None try: elems = logline.split('\t') code = elems[6] user_key = htscommon.get_user_key(code) fn = self._reg.path(user_key + [fname]) bdoc = htsbase.get_vote(fn) if bdoc: haal = bdoc.documents["%s.evote" % self._elid] voter = htscommon.get_logline_voter(logline) b64haal = base64.b64encode(haal).strip() res = [voter['jaoskond_omavalitsus'], voter['jaoskond'], voter['ringkond_omavalitsus'], voter['ringkond'], b64haal] except: evlog.log_exception() return res
def get_vote_for_result(self, logline, fname): res = None try: elems = logline.split('\t') code = elems[6] user_key = htscommon.get_user_key(code) fn = self._reg.path(user_key + [fname]) bdoc = htsbase.get_vote(fn) if bdoc: haal = bdoc.documents["%s.evote" % self._elid] voter = htscommon.get_logline_voter(logline) b64haal = base64.b64encode(haal).strip() res = [voter['jaoskond_omavalitsus'], voter['jaoskond'], \ voter['ringkond_omavalitsus'], voter['ringkond'], b64haal] except: evlog.log_exception() return res
def __load_bdoc(self, elid): voter_key = htscommon.get_user_key(self._voter_code) sreg = Election().get_sub_reg(elid) vote_files = [] for vfile in sreg.list_keys(voter_key): if htscommon.VALID_VOTE_PATTERN.match(vfile): vote_files.append(vfile) vote_files.sort() latest = vote_files.pop() if latest: bdoc = htsbase.get_vote(sreg.path(voter_key + [latest])) if not bdoc: evlog.log_error("No valid BDOC found for voter %s using vote ID %s" % \ (self._voter_code, self._vote_id)) raise HTSVerifyException, evcommon.VERIFY_ERROR return bdoc