def setup(self): g_config = None e_config = None configfile = open("%s/config" % self.__dir, "r") evcommon.skip_utf8_bom(configfile) g_config, e_config = read_config(configfile.readlines()) configfile.close() if Election().is_hes(): Election().set_hts_ip(g_config['*.hts']) Election().set_hts_path("/hts.cgi") Election().set_hts_verify_path("/hts-verify-vote.cgi") Election().config_hth_done() Election().set_mid_conf( g_config["*.mobidurl"], g_config["*.mobidservice"], g_config["*.mobidauthmsg"], g_config["*.mobidsignmsg"]) Election().set_session_length(g_config["*.sessionlength"]) for el in e_config: init_conf.execute(el, e_config[el]['type'], e_config[el]['description']) manage_rights(el, e_config[el]) config_common.config_hes(el, \ "%s/%s" % (self.__dir, e_config[el]['districts']), "%s/%s" % (self.__dir, e_config[el]['voters']), "%s/%s" % (self.__dir, e_config[el]['choices']), "%s/%s" % (self.__dir, e_config[el]['voterskey'])) if Election().is_hts(): Election().set_verification_time(g_config["*.verifytimeout"]) Election().set_verification_count(g_config["*.verifymaxtries"]) for el in e_config: init_conf.execute(el, e_config[el]['type'], e_config[el]['description']) manage_rights(el, e_config[el]) config_common.config_hts(el, "%s/%s" % (self.__dir, e_config[el]['districts']), "%s/%s" % (self.__dir, e_config[el]['voters']), "%s/%s" % (self.__dir, e_config[el]['choices']), "%s/%s" % (self.__dir, e_config[el]['voterskey'])) if Election().is_hlr(): for el in e_config: init_conf.execute(el, e_config[el]['type'], e_config[el]['description']) manage_rights(el, e_config[el]) config_common.config_hlr(el, "%s/%s" % (self.__dir, e_config[el]['districts']), "%s/%s" % (self.__dir, e_config[el]['choices']))
def setup(self): g_config = None e_config = None configfile = open("%s/config" % self.__dir, "r") evcommon.skip_utf8_bom(configfile) g_config, e_config = read_config(configfile.readlines()) configfile.close() if Election().is_hes(): Election().set_hts_ip(g_config['*.hts']) Election().set_hts_path("/hts.cgi") Election().set_hts_verify_path("/hts-verify-vote.cgi") Election().config_hth_done() Election().set_mid_conf(g_config["*.mobidurl"], g_config["*.mobidservice"], g_config["*.mobidauthmsg"], g_config["*.mobidsignmsg"]) Election().set_session_length(g_config["*.sessionlength"]) for el in e_config: init_conf.execute(el, e_config[el]['type'], e_config[el]['description']) manage_rights(el, e_config[el]) config_common.config_hes(el, \ "%s/%s" % (self.__dir, e_config[el]['districts']), "%s/%s" % (self.__dir, e_config[el]['voters']), "%s/%s" % (self.__dir, e_config[el]['choices']), "%s/%s" % (self.__dir, e_config[el]['voterskey'])) if Election().is_hts(): Election().set_verification_time(g_config["*.verifytimeout"]) Election().set_verification_count(g_config["*.verifymaxtries"]) for el in e_config: init_conf.execute(el, e_config[el]['type'], e_config[el]['description']) manage_rights(el, e_config[el]) config_common.config_hts( el, "%s/%s" % (self.__dir, e_config[el]['districts']), "%s/%s" % (self.__dir, e_config[el]['voters']), "%s/%s" % (self.__dir, e_config[el]['choices']), "%s/%s" % (self.__dir, e_config[el]['voterskey'])) if Election().is_hlr(): for el in e_config: init_conf.execute(el, e_config[el]['type'], e_config[el]['description']) manage_rights(el, e_config[el]) config_common.config_hlr( el, "%s/%s" % (self.__dir, e_config[el]['districts']), "%s/%s" % (self.__dir, e_config[el]['choices']))
def check_format(self, filename, msg=''): retval = True infile = None self.__tic = ticker.Ticker(os.stat(filename).st_size, msg) self.__count = 0 self.__curline = None try: infile = open(filename, 'r') evcommon.skip_utf8_bom(infile) if not self._check_header(infile): retval = False if not self.__ignore_errors: return retval if not self._check_body(infile): retval = False return retval finally: if not infile is None: infile.close()