Procházet zdrojové kódy

get_label now accepts integer and has correct return-type

GammaSQ před 5 roky
rodič
revize
2e637b5631
1 změnil soubory, kde provedl 2 přidání a 4 odebrání
  1. 2 4
      qubesadmin/app.py

+ 2 - 4
qubesadmin/app.py

@@ -216,10 +216,8 @@ class QubesBase(qubesadmin.base.PropertyHolder):
             pass
 
         # then search for index
-        if label.isdigit():
-            for i in self.labels:
-                if i.index == int(label):
-                    return i
+        if type(label) == int or label.isdigit():
+            return self.labels.values[int(label)]
 
         raise KeyError(label)