Skip to content

Commit

Permalink
only auto-generate IDs for resources with no ID, rather than for any …
Browse files Browse the repository at this point in the history
…falsy value
  • Loading branch information
mwestphall committed Sep 8, 2023
1 parent 325e67d commit cf336be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/webapp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def gen_id_from_yaml(data: dict, alternate_name: str, id_key = "ID", mod = 2 **
Given a yaml object, return its existing ID if an ID is present, or generate a new ID for the object
based on the md5sum of an alternate string value (usually the key of the object in its parent dictionary)
"""
return data.get(id_key) or gen_id(alternate_name, mod, minimum, hashfn)
return data[id_key] if data.get(id_key) is not None else gen_id(alternate_name, mod, minimum, hashfn)

def gen_id(instr: AnyStr, mod = 2 ** 31 - 1, minimum=1, hashfn=hashlib.md5) -> int:
"""
Expand Down

0 comments on commit cf336be

Please sign in to comment.