lxc-network/lxc_net/xml_template.py

17 lines
474 B
Python
Raw Normal View History

2020-03-09 12:14:26 +01:00
""" Reads an XML template from a file """
import os
class XMLTemplate:
""" Reads and instanciates a template from a file """
def __init__(self, path):
self.path = os.path.join(os.path.dirname(os.path.abspath(__file__)), path)
with open(self.path, "r") as handle:
self.template_str = handle.read()
def inst(self, *args, **kwargs):
""" instanciates the template """
return self.template_str.format(*args, **kwargs)