Explorar el Código

Fixes #25: Recurse expand_pattern only if there are more ranges to unpack

Jeremy Stretch hace 9 años
padre
commit
eade3cbd6b
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      netbox/utilities/forms.py

+ 2 - 2
netbox/utilities/forms.py

@@ -19,11 +19,11 @@ def expand_pattern(string):
     lead, pattern, remnant = re.split(EXPANSION_PATTERN, string, maxsplit=1)
     x, y = pattern.split('-')
     for i in range(int(x), int(y) + 1):
-        if remnant:
+        if re.search(EXPANSION_PATTERN, remnant):
             for string in expand_pattern(remnant):
                 yield "{}{}{}".format(lead, i, string)
         else:
-            yield "{}{}".format(lead, i)
+            yield "{}{}{}".format(lead, i, remnant)
 
 
 #