Skip to content

Commit 74f6e01

Browse files
committed
Filtering by the optinal attribute without any defined value considered
1 parent efb29e0 commit 74f6e01

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

mpewui.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ def __init__(self, qdict):
272272
self.fltopts[k] = val
273273
else:
274274
# Filter meaning: the option should present with any (non-None) value
275+
if k[-1] == '*':
276+
assert False, 'Only defined attributes can be optional: ' + k
277+
k = k[:-1]
275278
self.fltopts[k] = None
276279
# # Fetch the kind of items to be shown
277280
# self.kind = qdict.get(UiResOpt.kind.name) #pylint: disable=E1101
@@ -460,7 +463,7 @@ def root(cmd):
460463
# Parse URL parameters and form the UI command parameters
461464
try:
462465
resopts = ResultOptions(bottle.request.query)
463-
except (KeyError, ValueError) as err:
466+
except (KeyError, ValueError, AssertionError) as err:
464467
# 400 - Bad Request
465468
# 415 - Unsupported Media Type
466469
bottle.response.status = 400

views/restapi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
<p>Query <strong>examples</strong>:
5959
<ul>
6060
<li>
61-
Show tasks with their jobs having <var>rcode=-15</var> if exists, <var>1.5 sec &le; duration &lt; 3600 sec</var> and <var>category</var> attribute might present with any value:
61+
Show tasks with their jobs having <var>rcode=-15</var> if exists, <var>1.5 sec &le; duration &lt; 3600 sec</var> and <var>cat1 &le; category &lt; cat5 </var> if exists:
6262
<pre>
63-
http://localhost:8080/tasks?flt=rcode*:-15|duration:1.5..3600|category*
63+
http://localhost:8080/tasks?flt=rcode*:-15|duration:1.5..3600|category*=cat1..cat5
6464
</pre>
6565
</li>
6666
<li>

0 commit comments

Comments
 (0)