3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-02-02 15:44:06 +01:00

utils: check explicitly for "pos is None", as 0 is a falsey value too

Without this, the UID generator would refuse to change the left-most character of the UID, as it is position 0.
This commit is contained in:
James Lu 2016-04-05 18:44:00 -07:00
parent 1e3aba2cce
commit e2edc68fe8

View File

@ -58,7 +58,8 @@ class IncrementalUIDGenerator():
Increments the UID generator to the next available UID.
"""
# Position starts at 1 less than the UID length.
pos = pos or (self.length - 1)
if pos is None:
pos = self.length - 1
# If we're at the last character in the list of allowed ones, reset
# and increment the next level above.