Skip to content

Commit

Permalink
do not retrive disabled modules from db
Browse files Browse the repository at this point in the history
This avoid polymorphic errors when a module is loaded from db
but not known as not installed on python side.

The fix is partial as modules are accessed at others places,
like from permissions.
  • Loading branch information
bouttier authored and TheoLechemia committed Sep 14, 2023
1 parent e66367d commit bd7fb5c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/geonature/core/gn_commons/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ def list_modules():
"""
params = request.args
q = TModules.query.options(joinedload(TModules.objects))
exclude = current_app.config["DISABLED_MODULES"]
if "exclude" in params:
q = q.filter(TModules.module_code.notin_(params.getlist("exclude")))
exclude.extend(params.getlist("exclude"))
q = q.filter(TModules.module_code.notin_(exclude))
q = q.order_by(TModules.module_order.asc()).order_by(TModules.module_label.asc())
modules = q.all()
allowed_modules = []
for module in modules:
if module.module_code in current_app.config["DISABLED_MODULES"]:
continue
module_allowed = False
# HACK : on a besoin d'avoir le module GeoNature en front pour l'URL de la doc
if module.module_code == "GEONATURE":
Expand Down

0 comments on commit bd7fb5c

Please sign in to comment.