[Kimchi-devel] [PATCH] [Wok] Raise 401 HTTP Error when login fails
Ramon Medeiros
ramonn at linux.vnet.ibm.com
Wed Jan 27 19:50:07 UTC 2016
Reviewed-By: Ramon Medeiros <ramonn at br.ibm.com>
On 01/27/2016 05:42 PM, Aline Manera wrote:
> When using the REST API to login into Wok, on any error the return code was
> wrongly set to 500, due the OperationFailed exception.
> Fix it.
>
> Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
> ---
> src/wok/auth.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/wok/auth.py b/src/wok/auth.py
> index afd4cf4..3f1c8d5 100644
> --- a/src/wok/auth.py
> +++ b/src/wok/auth.py
> @@ -70,8 +70,8 @@ class User(object):
> if not klass.authenticate(**auth_args):
> debug("cannot verify user with the given password")
> return None
> - except OperationFailed:
> - raise
> + except OperationFailed, e:
> + raise cherrypy.HTTPError(401, e.message)
> return klass(auth_args['username'])
>
>
--
Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
ramonn at br.ibm.com
More information about the Kimchi-devel
mailing list