From 8e690c6858d9533248a9754b3bad51c221daa4d4 Mon Sep 17 00:00:00 2001 From: Wojtek Porczyk Date: Tue, 23 Jun 2015 22:46:56 +0200 Subject: [PATCH] qubes: fix saving Label --- qubes/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qubes/__init__.py b/qubes/__init__.py index 36aad18c..ff8d0d1d 100644 --- a/qubes/__init__.py +++ b/qubes/__init__.py @@ -333,7 +333,7 @@ class Label(object): def __xml__(self): 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 return element @@ -1285,7 +1285,7 @@ class Qubes(PropertyHolder): ''' 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__()) return labels