""" 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. """ class SupportedType: 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 GetName(self): return self.__name def GetDescription(self): return self.__description def GetExtensions(self): return self.__extensions 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 def SetName(self, name): self.__name = name return def SetDescription(self, description): self.__description = description return def SetExtensions(self, extensions): self.__extensions = extensions return def SetTemplateData(self, template_data): self.__template_data = template_data return def SetTemplateFile(self, template_file): self.__template_file = template_file return