Clarify prototype_key replacement in modules; address #1676.
This commit is contained in:
parent
c0c36a8641
commit
77cf8075d9
1 changed files with 5 additions and 3 deletions
|
|
@ -105,9 +105,11 @@ def homogenize_prototype(prototype, custom_keys=None):
|
||||||
for mod in settings.PROTOTYPE_MODULES:
|
for mod in settings.PROTOTYPE_MODULES:
|
||||||
# to remove a default prototype, override it with an empty dict.
|
# to remove a default prototype, override it with an empty dict.
|
||||||
# internally we store as (key, desc, locks, tags, prototype_dict)
|
# internally we store as (key, desc, locks, tags, prototype_dict)
|
||||||
prots = [(prototype_key.lower(), homogenize_prototype(prot))
|
prots = []
|
||||||
for prototype_key, prot in all_from_module(mod).items()
|
for variable_name, prot in all_from_module(mod).items():
|
||||||
if prot and isinstance(prot, dict)]
|
if "prototype_key" not in prot:
|
||||||
|
prot['prototype_key'] = variable_name.lower()
|
||||||
|
prots.append((prot['prototype_key'], homogenize_prototype(prot)))
|
||||||
# assign module path to each prototype_key for easy reference
|
# assign module path to each prototype_key for easy reference
|
||||||
_MODULE_PROTOTYPE_MODULES.update({prototype_key.lower(): mod for prototype_key, _ in prots})
|
_MODULE_PROTOTYPE_MODULES.update({prototype_key.lower(): mod for prototype_key, _ in prots})
|
||||||
# make sure the prototype contains all meta info
|
# make sure the prototype contains all meta info
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue