From 9327b55e147d95b5865f23788f980c7268ea03e3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 20 Apr 2015 21:38:42 +0200 Subject: Spare code cosmetics (7) --- pyload/webui/app/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pyload/webui/app/utils.py') diff --git a/pyload/webui/app/utils.py b/pyload/webui/app/utils.py index 69067d8fe..8957f061e 100644 --- a/pyload/webui/app/utils.py +++ b/pyload/webui/app/utils.py @@ -80,8 +80,8 @@ def set_session(request, info): def parse_userdata(session): - return {"name": session.get("name", "Anonymous"), - "is_admin": True if session.get("role", 1) == 0 else False, + return {"name" : session.get("name", "Anonymous"), + "is_admin" : session.get("role", 1) == 0, "is_authenticated": session.get("authenticated", False)} -- cgit v1.2.3 From 1e2e91091664c2fca6a187804b2041eab757dbe3 Mon Sep 17 00:00:00 2001 From: fedeG Date: Mon, 20 Apr 2015 22:01:18 +0200 Subject: PEP-8, Python Zen, refactor and reduce code (part 15 in master module/webui/app) Conflicts: pyload/webui/app/api.py pyload/webui/app/cnl.py pyload/webui/app/json.py pyload/webui/app/pyloadweb.py pyload/webui/app/utils.py --- pyload/webui/app/utils.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'pyload/webui/app/utils.py') diff --git a/pyload/webui/app/utils.py b/pyload/webui/app/utils.py index 8957f061e..2753b7feb 100644 --- a/pyload/webui/app/utils.py +++ b/pyload/webui/app/utils.py @@ -115,10 +115,7 @@ def login_required(perm=None): def toDict(obj): - ret = {} - for att in obj.__slots__: - ret[att] = getattr(obj, att) - return ret + return {att: getattr(obj, att) for att in obj.__slots__} class CherryPyWSGI(ServerAdapter): -- cgit v1.2.3