def _load_templates(self):
"""
Loads provider template from TEMPLATE_DIR
:rtype: dict:
:return: All templates available in TEMPLATE_DIR
"""
template_base = os.path.dirname(os.path.realpath(__file__)) + TEMPLATE_DIR
modules = glob.glob(os.path.join(template_base, '*.py'))
template_files = [os.path.basename(f)[:-3] for f in modules if not f.endswith('__init__.py')]
templates = {}
for template in template_files:
infos = imp.load_source(template, os.path.join(template_base, template + '.py'))
templates[infos.TEMPLATE.pop('email')] = infos.TEMPLATE
return templates
评论列表
文章目录