def add_html_templates(self, path): if self.custom: return templates = dict() for fname in os.listdir(path): if fname.endswith(".html"): with io.open(os.path.join(path, fname), 'r', encoding = 'utf-8') as f: templates[fname.split('.')[0]] = scrub_html_template(f.read()) self.set("__templates", templates or None)
def add_html_templates(self, path): if self.custom: return templates = dict() for fname in os.listdir(path): if fname.endswith(".html"): with open(os.path.join(path, fname), 'r') as f: templates[fname.split('.')[0]] = scrub_html_template(text_type(f.read(), "utf-8")) self.set("__templates", templates or None)