Skip to content

Commit

Permalink
feat(modules): custom module label
Browse files Browse the repository at this point in the history
  • Loading branch information
bouttier committed Nov 20, 2024
1 parent d01daa7 commit 46e09a8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/geonature/utils/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ def module_db_upgrade(module_dist, directory=None, sql=False, tag=None, x_arg=[]
).scalar_one_or_none()
if module is None:
# add module to database
try:
module_label = module_dist.entry_points["label"].load()
except KeyError:
module_label = module_code.capitalize()

Check warning on line 116 in backend/geonature/utils/module.py

View check run for this annotation

Codecov / codecov/patch

backend/geonature/utils/module.py#L113-L116

Added lines #L113 - L116 were not covered by tests
try:
module_picto = module_dist.entry_points["picto"].load()
except KeyError:
Expand All @@ -125,7 +129,7 @@ def module_db_upgrade(module_dist, directory=None, sql=False, tag=None, x_arg=[]
module = TModules(
type=module_type,
module_code=module_code,
module_label=module_code.capitalize(),
module_label=module_label,
module_path=module_code.lower(),
module_target="_self",
module_picto=module_picto,
Expand Down

0 comments on commit 46e09a8

Please sign in to comment.