Kaynağa Gözat

Use ChoiceSet.values() for access to raw values

Jeremy Stretch 6 yıl önce
ebeveyn
işleme
1d3651e255
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. 1 1
      netbox/utilities/utils.py

+ 1 - 1
netbox/utilities/utils.py

@@ -168,7 +168,7 @@ def to_meters(length, unit):
     if length < 0:
     if length < 0:
         raise ValueError("Length must be a positive integer")
         raise ValueError("Length must be a positive integer")
 
 
-    valid_units = [u[0] for u in CableLengthUnitChoices]
+    valid_units = CableLengthUnitChoices.values()
     if unit not in valid_units:
     if unit not in valid_units:
         raise ValueError(
         raise ValueError(
             "Unknown unit {}. Must be one of the following: {}".format(unit, ', '.join(valid_units))
             "Unknown unit {}. Must be one of the following: {}".format(unit, ', '.join(valid_units))