[elbe-devel] [PATCH 46/75] daemons soap authentication: Fix Pylint

Olivier Dion dion at linutronix.de
Fri May 29 22:42:54 CEST 2020


On Fri, 29 May 2020, Olivier Dion <dion at linutronix.de> wrote:
> On Fri, 29 May 2020, Torben Hohn <torben.hohn at linutronix.de> wrote:
>> On Mon, May 25, 2020 at 11:42:39AM -0400, Olivier Dion wrote:
>>> 23:4:  R1705: (no-else-return)
>>> 106:4: R1705: (no-else-return)
>>> 
>>> Signed-off-by: Olivier Dion <dion at linutronix.de>
>>
>> dont ignore it, remove the else
>
> What about:
> ----------------------------------------------------------------------
> @wraps(func)
> def wrapped(self, *args):
>     s = self.transport.req_env['beaker.session']
>     try:
>         uid = s['userid']
>     except KeyError:
>         raise SoapElbeNotLoggedIn()
>
>     return func(self, uid, *args)
> return wrapped
> ----------------------------------------------------------------------
>
> and:
> ----------------------------------------------------------------------
> @wraps(func)
> def wrapped(self, *args):
>     s = self.transport.req_env['beaker.session']
>     try:
>         uid = s['userid']
>     except KeyError:
>         raise SoapElbeNotLoggedIn()
>
>     if not self.app.pm.db.is_admin(uid):
>         raise SoapElbeNotAuthorized()
>     return func(self, *args)
> return wrapped
> ----------------------------------------------------------------------

Err nvm.  That spyne crap is a real mess.

-- 
Olivier Dion
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen



More information about the elbe-devel mailing list