summaryrefslogtreecommitdiffstats
path: root/pyload/webui/app/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/webui/app/utils.py')
-rw-r--r--pyload/webui/app/utils.py20
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