From 74f6e019f70999c1c8578a156ba04a9cd539cf8d Mon Sep 17 00:00:00 2001 From: luav Date: Sat, 2 Jun 2018 00:24:51 +0200 Subject: [PATCH] Filtering by the optinal attribute without any defined value considered --- mpewui.py | 5 ++++- views/restapi.md | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mpewui.py b/mpewui.py index bb6eee9..60012c6 100755 --- a/mpewui.py +++ b/mpewui.py @@ -272,6 +272,9 @@ def __init__(self, qdict): self.fltopts[k] = val else: # Filter meaning: the option should present with any (non-None) value + if k[-1] == '*': + assert False, 'Only defined attributes can be optional: ' + k + k = k[:-1] self.fltopts[k] = None # # Fetch the kind of items to be shown # self.kind = qdict.get(UiResOpt.kind.name) #pylint: disable=E1101 @@ -460,7 +463,7 @@ def root(cmd): # Parse URL parameters and form the UI command parameters try: resopts = ResultOptions(bottle.request.query) - except (KeyError, ValueError) as err: + except (KeyError, ValueError, AssertionError) as err: # 400 - Bad Request # 415 - Unsupported Media Type bottle.response.status = 400 diff --git a/views/restapi.md b/views/restapi.md index 3d4826b..12b26f7 100644 --- a/views/restapi.md +++ b/views/restapi.md @@ -58,9 +58,9 @@

Query examples: