class SupportedType: """ Wrapper class for the 'filetype' elements in the config file. Nothing tricky here, except that the accessor for the template should intelligently determine which of the two fields (template_file, template_data) is used as the template source. """ def __init__(self, name = "", description = "", extensions = [], template_file = "", template_data = ""): self.name = name self.description = description self.extensions = extensions self.template_file = template_file self.template_data = template_data return def GetTemplate(self): if (self.template_data == None or self.template_data == ''): # The data is not given explicitly, so rely on the # template file to provide it. template_file = open(self.template_file, 'r') template = template_file.read() template_file.close() return template else: return self.template_data