Exemplo n.º 1
0
	def save(self):
		lst = ['<?xml version="1.0" ?>\n<pluginsort>\n\n']
		append = lst.append
		extend = lst.extend

		idmap = reverse(WHEREMAP)
		for key in self.plugins.keys():
			whereplugins = self.plugins.get(key, None)
			if not whereplugins:
				continue

			where = idmap[key]
			extend((' <where type="', str(where), '">\n'))
			for key, value in iteritems(whereplugins):
				extend(('  <plugin name="', stringToXML(str(key)), '" weight="', str(value), '" />\n'))
			append((' </where>\n'))
		append('\n</pluginsort>\n')
		
		with open(XML_CONFIG, 'w') as config:
			config.writelines(lst)
Exemplo n.º 2
0
	def save(self):
		lst = ['<?xml version="1.0" ?>\n<pluginsort>\n\n']
		append = lst.append
		extend = lst.extend

		idmap = reverse(WHEREMAP)
		for key in self.plugins.keys():
			whereplugins = self.plugins.get(key, None)
			if not whereplugins:
				continue

			where = idmap[key]
			extend((' <where type="', str(where), '">\n'))
			for key, value in iteritems(whereplugins):
				extend(('  <plugin name="', stringToXML(str(key)), '" weight="', str(value), '" />\n'))
			append((' </where>\n'))
		append('\n</pluginsort>\n')
		
		with open(XML_CONFIG, 'w') as config:
			config.writelines(lst)