Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def load_template(classname, encoding=None):
"""
Loads the given template. This only handles .kid files.
Returns a tuple (compiled_tmpl, None) to emulate
turbogears.meta.load_kid_template() which ends up not properly handling
encoding.
"""
if not encoding:
encoding = turbogears.config.get('kid.encoding', kidsupport.KidSupport.assume_encoding)
divider = classname.rfind(".")
package, basename = classname[:divider], classname[divider+1:]
file_path = resource_filename(package, basename + ".kid")
tclass = kid.load_template(
file_path,
name = classname,
).Template
tclass.serializer = kid.HTMLSerializer(encoding=encoding)
tclass.assume_encoding=encoding
return (tclass, None)