qubes: fix saving Label

This commit is contained in:
Wojtek Porczyk 2015-06-23 22:46:56 +02:00
parent d5f2e6ab74
commit 8e690c6858

View File

@ -333,7 +333,7 @@ class Label(object):
def __xml__(self): def __xml__(self):
element = lxml.etree.Element( element = lxml.etree.Element(
'label', id='label-' + self.index, color=self.color) 'label', id='label-{}'.format(self.index), color=self.color)
element.text = self.name element.text = self.name
return element return element
@ -1285,7 +1285,7 @@ class Qubes(PropertyHolder):
''' '''
labels = lxml.etree.Element('labels') labels = lxml.etree.Element('labels')
for label in self.labels: for label in sorted(self.labels.values(), key=lambda labl: labl.index):
labels.append(label.__xml__()) labels.append(label.__xml__())
return labels return labels