Skip to content

Commit

Permalink
Merge pull request #3384 from mwestphall/bugfix/allow-zero-id
Browse files Browse the repository at this point in the history
Bugfix: Allow ID=0
  • Loading branch information
matyasselmeci authored Sep 8, 2023
2 parents 325e67d + cf336be commit f3586e1
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 f3586e1

Please sign in to comment.