]> git.ipfire.org Git - thirdparty/patchwork.git/commit
xmlrpc: catch possible exceptions in patch filtering
authorDaniel Axtens <dja@axtens.net>
Sat, 3 Sep 2016 07:07:17 +0000 (17:07 +1000)
committerStephen Finucane <stephenfinucane@hotmail.com>
Sat, 3 Sep 2016 22:40:59 +0000 (23:40 +0100)
commitfdf35e3a79a57abecdd504bb65943d147e798f6f
tree54a447511a187fe1175f67059e38f985f3b8f2b3
parent8afa39f9a93698ceebbbd756a51b7b0fc1650c7d
xmlrpc: catch possible exceptions in patch filtering

Currently, filtering by project, submitter, delegate or state uses a
filter(id=filt[key])[0]. This will throw an exception when something
isn't found, as filter will return [], and getting the first element of
that will fail.

Convert them to explicit get()s, so it's clearer that they can throw an
exception, then catch the 3 possible types of DoesNotExists exceptions.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
patchwork/views/xmlrpc.py