def talleta_haal(self, **args): haale_rasi = ksum.votehash(args['vote']) user_key = htscommon.get_user_key(args['signercode']) self._reg.ensure_key(user_key) voter = args['valija'] vote_file = htscommon.valid_votefile_name(args['timestamp']) user_key.append(vote_file) filename = self._reg.path(user_key) frm = evlog.EvLogFormat() logline = frm.logstring( tyyp=0, haal_rasi=haale_rasi, timestamp=args['timestamp'], jaoskond=voter['jaoskond'], jaoskond_omavalitsus=voter['jaoskond_omavalitsus'], ringkond=voter['ringkond'], ringkond_omavalitsus=voter['ringkond_omavalitsus'], isikukood=args['signercode'], nimi=voter['nimi'], reanumber=voter['reanumber']) outdata = StringIO.StringIO() outzip = zipfile.ZipFile(outdata, 'w') outzip.writestr(htscommon.ZIP_BDOCFILE, args['signedvote']) outzip.writestr(htscommon.ZIP_LOGFILE, logline) outzip.close() self._write_atomic(filename, outdata.getvalue())
def __init__(self, elid, tmpdir): self._elid = elid evlog.AppLog().set_app('HLR', self._elid) self._reg = Election().get_sub_reg(self._elid) self._log4 = evlog.Logger('log4') self._log5 = evlog.Logger('log5') self._log4.set_format(evlog.EvLogFormat()) self._log5.set_format(evlog.EvLogFormat()) self._log4.set_logs(self._reg.path(['common', 'log4'])) self._log5.set_logs(self._reg.path(['common', 'log5'])) tmpreg = evreg.Registry(root=tmpdir) tmpreg.ensure_key([]) tmpreg.delete_sub_keys([]) self.output_file = tmpreg.path(['decrypted_votes']) self.__cnt = ChoicesCounter()