diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-19 21:58:08 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-19 21:58:08 +0100 |
commit | 63f8af1fc3049527a4a4b53a1bbfde90cb4b2eb3 (patch) | |
tree | 8227674ebd87c28df53bad55de401a9264a283b4 /module/web/pyload_app.py | |
parent | fixed cli unicode error (diff) | |
download | pyload-63f8af1fc3049527a4a4b53a1bbfde90cb4b2eb3.tar.xz |
encoding fixes
Diffstat (limited to 'module/web/pyload_app.py')
-rw-r--r-- | module/web/pyload_app.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/module/web/pyload_app.py b/module/web/pyload_app.py index 82701e755..643e1e75c 100644 --- a/module/web/pyload_app.py +++ b/module/web/pyload_app.py @@ -38,7 +38,7 @@ from webinterface import PYLOAD, PROJECT_DIR, SETUP from utils import render_to_response, parse_permissions, parse_userdata, login_required from filters import relpath, unquotepath -from module.utils import formatSize +from module.utils import formatSize, decode # Helper @@ -69,6 +69,9 @@ def base(messages): ## Views @error(500) def error500(error): + if request.header.get('X-Requested-With') == 'XMLHttpRequest': + return HTTPError(500, error.traceback) + return base(["An Error occured, please enable debug mode to get more details.", error, error.traceback.replace("\n", "<br>") if error.traceback else "No Traceback"]) @@ -103,6 +106,7 @@ def login_post(): s = request.environ.get('beaker.session') s["authenticated"] = True + s["id"] = info["id"] s["name"] = info["name"] s["role"] = info["role"] s["perms"] = info["permission"] @@ -171,14 +175,14 @@ def downloads(): for item in sorted(listdir(root)): if isdir(join(root, item)): folder = { - 'name': item, - 'path': item, + 'name': decode(item), + 'path': decode(item), 'files': [] } for file in sorted(listdir(join(root, item))): try: if isfile(join(root, item, file)): - folder['files'].append(file) + folder['files'].append(decode(file)) except: pass @@ -466,7 +470,7 @@ def logs(item=-1): if counter >= item: try: - date, time, level, message = l.split(" ", 3) + date, time, level, message = l.decode("utf8", "ignore").split(" ", 3) dtime = datetime.strptime(date + ' ' + time, '%d.%m.%Y %H:%M:%S') except: dtime = None |