From e2edc68fe834c3b31a4bde186ca58897b3485dcf Mon Sep 17 00:00:00 2001 From: James Lu Date: Tue, 5 Apr 2016 18:44:00 -0700 Subject: [PATCH] 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. --- utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils.py b/utils.py index 494b1eb..5d47b9c 100644 --- a/utils.py +++ b/utils.py @@ -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.