On 03 Sep 17:07, Daniel Axtens wrote:
> filter() returns a list or [], and get() returns an object or raises an
> exception.
> 
> Currently, we use filter()[0] inside a try/except model.DoesNotExist
> block. This doesn't work: if filter returns [] we'll get an exception
> about list indices, not a DoesNotExist exception.
> 
> Switch these over to get(), allowing them to use the existing exception
> flow.
> 
> Signed-off-by: Daniel Axtens <[email protected]>

Damn. Good catch.

Reviewed-by: Stephen Finucane <[email protected]>
_______________________________________________
Patchwork mailing list
[email protected]
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to