Coverage for src/lightmlboard/templates/__init__.py: 0%
8 statements
« prev ^ index » next coverage.py v6.4.1, created at 2022-06-05 11:12 +0200
« prev ^ index » next coverage.py v6.4.1, created at 2022-06-05 11:12 +0200
1"""
2@file
3@brief About templates.
4"""
5import os
8def get_template(name):
9 """
10 Get a template name.
12 @param name template name
13 @return content
14 """
15 this = os.path.dirname(name)
16 tm = os.path.join(this, name)
17 if not os.path.exists(tm):
18 raise FileNotFoundError("Unable to find template '{0}'.".format(name))
19 with open(tm, "r", encoding="utf-8") as f:
20 return f.read()