From bb5a115533711fd8bb87f53cb32ff7342137208d Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 18 Apr 2015 00:29:55 +0200 Subject: Spare code cosmetics (5) --- pyload/webui/app/api.py | 2 +- pyload/webui/app/json.py | 10 +++++++--- pyload/webui/app/utils.py | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'pyload/webui/app') diff --git a/pyload/webui/app/api.py b/pyload/webui/app/api.py index 16e8c2447..0e36b7c1f 100644 --- a/pyload/webui/app/api.py +++ b/pyload/webui/app/api.py @@ -17,6 +17,7 @@ from pyload.api import BaseObject # json encoder that accepts TBase objects class TBaseEncoder(json.JSONEncoder): + def default(self, o): if isinstance(o, BaseObject): return toDict(o) @@ -24,7 +25,6 @@ class TBaseEncoder(json.JSONEncoder): # accepting positional arguments, as well as kwargs via post and get - @route('/api/') @route('/api/', method='POST') def call_api(func, args=""): diff --git a/pyload/webui/app/json.py b/pyload/webui/app/json.py index 51159ddf3..12dce2484 100644 --- a/pyload/webui/app/json.py +++ b/pyload/webui/app/json.py @@ -241,7 +241,8 @@ def load_config(category, section): conf = PYLOAD.getPluginConfigDict() for key, option in conf[section].iteritems(): - if key in ("desc", "outline"): continue + if key in ("desc", "outline"): + continue if ";" in option['type']: option['list'] = option['type'].split(";") @@ -282,12 +283,14 @@ def update_accounts(): for name, value in request.POST.iteritems(): value = value.strip() - if not value: continue + if not value: + continue tmp, user = name.split(";") plugin, action = tmp.split("|") - if (plugin, user) in deleted: continue + if (plugin, user) in deleted: + continue if action == "password": PYLOAD.updateAccount(plugin, user, value) @@ -299,6 +302,7 @@ def update_accounts(): deleted.append((plugin,user)) PYLOAD.removeAccount(plugin, user) + @route('/json/change_password', method='POST') def change_password(): diff --git a/pyload/webui/app/utils.py b/pyload/webui/app/utils.py index f9931f531..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()) @@ -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) -- cgit v1.2.3