diff options
author | ardi69 <armin@diedering.de> | 2015-04-18 14:08:18 +0200 |
---|---|---|
committer | ardi69 <armin@diedering.de> | 2015-04-18 14:08:18 +0200 |
commit | 6e8f84e1dc06cff6fa9387559992f555182c1774 (patch) | |
tree | 476600f9896fae029880e4049eb4c5e6021b202d /pyload/webui/app/utils.py | |
parent | fix: config cast (diff) | |
parent | Spare code cosmetics (5) (diff) | |
download | pyload-6e8f84e1dc06cff6fa9387559992f555182c1774.tar.xz |
Merge pull request #3 from vuolter/0.4.10
merge vuolter HEAD
Diffstat (limited to 'pyload/webui/app/utils.py')
-rw-r--r-- | pyload/webui/app/utils.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/pyload/webui/app/utils.py b/pyload/webui/app/utils.py index ac7fa84fb..69067d8fe 100644 --- a/pyload/webui/app/utils.py +++ b/pyload/webui/app/utils.py @@ -9,6 +9,7 @@ from pyload.webui import env, THEME from pyload.api import has_permission, PERMS, ROLE + def render_to_response(file, args={}, proc=[]): for p in proc: args.update(p()) @@ -18,8 +19,8 @@ def render_to_response(file, args={}, proc=[]): def parse_permissions(session): perms = dict((x, False) for x in dir(PERMS) if not x.startswith("_")) - perms["ADMIN"] = False - perms["is_admin"] = False + perms['ADMIN'] = False + perms['is_admin'] = False if not session.get("authenticated", False): return perms @@ -56,7 +57,8 @@ def set_permission(perms): """ permission = 0 for name in dir(PERMS): - if name.startswith("_"): continue + if name.startswith("_"): + continue if name in perms and perms[name]: permission |= getattr(PERMS, name) @@ -66,12 +68,12 @@ def set_permission(perms): def set_session(request, info): s = request.environ.get('beaker.session') - s["authenticated"] = True - s["user_id"] = info["id"] - s["name"] = info["name"] - s["role"] = info["role"] - s["perms"] = info["permission"] - s["template"] = info["template"] + s['authenticated'] = True + s['user_id'] = info['id'] + s['name'] = info['name'] + s['role'] = info['role'] + s['perms'] = info['permission'] + s['template'] = info['template'] s.save() return s |