]> gitweb.michael.orlitzky.com - dead/pictar.git/blob - Mime/SupportedType.py
Updated XmlDataParser to use the Python 2.5 ElementTree interface.
[dead/pictar.git] / Mime / SupportedType.py
1 class SupportedType:
2 """
3 Wrapper class for the 'filetype' elements in the config
4 file. Nothing tricky here, except that the accessor for the
5 template should intelligently determine which of the two fields
6 (template_file, template_data) is used as the template source.
7 """
8
9 def __init__(self,
10 name = "",
11 description = "",
12 extensions = [],
13 template_file = "",
14 template_data = ""):
15
16 self.name = name
17 self.description = description
18 self.extensions = extensions
19 self.template_file = template_file
20 self.template_data = template_data
21
22 return
23
24
25 def GetTemplate(self):
26 if (self.template_data == None or self.template_data == ''):
27 # The data is not given explicitly, so rely on the
28 # template file to provide it.
29 template_file = open(self.template_file, 'r')
30 template = template_file.read()
31 template_file.close()
32 return template
33 else:
34 return self.template_data
35