aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2022-07-11 16:17:43 +0200
committerDaniel Schadt <kingdread@gmx.de>2022-07-11 16:17:43 +0200
commit510a8b58e5c735b27885d2c0347d1b54ab6eb387 (patch)
treedbafff970c35bfd06d52c1875e5d5711079a6ee3
parent68313fb431a2174dadbdb0a74c56a0a65d9d8594 (diff)
downloadfietsboek-510a8b58e5c735b27885d2c0347d1b54ab6eb387.tar.gz
fietsboek-510a8b58e5c735b27885d2c0347d1b54ab6eb387.tar.bz2
fietsboek-510a8b58e5c735b27885d2c0347d1b54ab6eb387.zip
ignore empty IDs when retrieving multiple
This is for example useful for the template inputs. They should not be sent due to the "disabled" attribute, but we never know what browsers are doing, therefore we stay defensive. The test case already has to do extra steps to prevent those from being sent.
-rw-r--r--fietsboek/util.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/fietsboek/util.py b/fietsboek/util.py
index d3a4064..f62a0d5 100644
--- a/fietsboek/util.py
+++ b/fietsboek/util.py
@@ -231,6 +231,8 @@ def retrieve_multiple(dbsession, model, params, name):
"""
objects = []
for obj_id in params.getall(name):
+ if not obj_id:
+ continue
query = select(model).filter_by(id=obj_id)
obj = dbsession.execute(query).scalar_one_or_none()
if obj is None: