Version
Version de GeoNature affectée par le bug.
2.14.2
Description du bug
Comportement attendu
Avoir un code_status 200 à la requête api gn_profiles/check_observation
Comment reproduire
Ouvrir Occtax (version web) et saisir un taxon figurant dans la vue matérialisée gn_profiles.vm_valid_profiles avec le champs active_life_stage = True
Logs
[5b40d84f-ff05-43cb-8667-4fc7b7f8f995] Exception on /gn_profiles/check_observation [POST]
Traceback (most recent call last):
File "/home/geonatureadmin/geonature/backend/venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
File "/home/geonatureadmin/geonature/backend/venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File "/home/geonatureadmin/geonature/backend/venv/lib/python3.10/site-packages/utils_flask_sqla/response.py", line 19, in _json_resp
res = fn(*args, **kwargs)
File "/home/geonatureadmin/geonature/backend/geonature/core/gn_profiles/routes.py", line 225, in get_observation_score
life_stage_value = DB.get(TNomenclatures, life_stage)
File "/home/geonatureadmin/geonature/backend/venv/lib/python3.10/site-packages/flask_sqlalchemy/extension.py", line 1008, in __getattr__
raise AttributeError(name)
AttributeError: get
[2024-08-19 18:02:44 +0200] [1740666] [ERROR] Exception on /gn_profiles/check_observation [POST]
Traceback (most recent call last):
File "/home/geonatureadmin/geonature/backend/venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
File "/home/geonatureadmin/geonature/backend/venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File "/home/geonatureadmin/geonature/backend/venv/lib/python3.10/site-packages/utils_flask_sqla/response.py", line 19, in _json_resp
res = fn(*args, **kwargs)
File "/home/geonatureadmin/geonature/backend/geonature/core/gn_profiles/routes.py", line 225, in get_observation_score
life_stage_value = DB.get(TNomenclatures, life_stage)
File "/home/geonatureadmin/geonature/backend/venv/lib/python3.10/site-packages/flask_sqlalchemy/extension.py", line 1008, in __getattr__
raise AttributeError(name)
AttributeError: get
Solution trouvée
Remplacer DB.get par DB.get_or_404 (utilisé dans les autres fonctions)
File "/home/geonatureadmin/geonature/backend/geonature/core/gn_profiles/routes.py", line 225, in get_observation_score
Version Version de GeoNature affectée par le bug. 2.14.2
Description du bug
Comportement attendu Avoir un code_status 200 à la requête api
gn_profiles/check_observation
Comment reproduire Ouvrir Occtax (version web) et saisir un taxon figurant dans la vue matérialisée
gn_profiles.vm_valid_profiles
avec le champsactive_life_stage = True
Logs
Solution trouvée Remplacer
DB.get
parDB.get_or_404
(utilisé dans les autres fonctions) File "/home/geonatureadmin/geonature/backend/geonature/core/gn_profiles/routes.py", line 225, in get_observation_score