def __init__(self, p_name,p_tag,p_class,p_id): self._name = "'"+p_name+"'" if p_name else "null" self._tag = "'"+p_tag+"'" if p_tag else "null" self._class = "'"+p_class+"'" if p_class else "null" self._id = "'"+p_id+"'" if p_id else "null" self._find_script = open(Configure.get_application_root_dir()+"/js/findelements_min.js") self._select_script = open(Configure.get_application_root_dir()+"/js/select_min.js") self._find_scripts = None self._select_scripts = None if self._find_script: self._find_scripts = self._find_script.readline() if self._select_script: self._select_scripts = self._select_script.readline()
def init(self, kv=False): conf_file = open(Configure.get_application_root_dir() + "/template/" + self._configure_file) configures = "".join(conf_file.readlines()) if not kv: self.populate_page_components(p_configure=configures) else: self.populate_page_kvcomponents(p_configure=configures) self.populate_pagination(p_configure=configures)
def submit(self, uri, pid, template, tid): taskfile = open( Configure.get_application_root_dir() + "/task/task_" + pid + ".xml", "ab") content = """ <crawl> <task> <pid>%s</pid> <uri>%s</uri> <template>%s</template> <id>%s</id> </task> </crawl> """ % (pid, uri, template, tid) taskfile.write(bytes(content, encoding="utf8")) taskfile.close()