summaryrefslogtreecommitdiffstats
path: root/pyload/webui/app/json.py
diff options
context:
space:
mode:
authorGravatar ardi69 <armin@diedering.de> 2015-04-21 06:51:24 +0200
committerGravatar ardi69 <armin@diedering.de> 2015-04-21 06:51:24 +0200
commit2f8433b6a10505d29a1b63ea8bbd9b0bf3f7d9f6 (patch)
treeb82a8b5fc0a309f69733b0a004284f4ef45833d8 /pyload/webui/app/json.py
parentadded check of classname == filename (diff)
parentMerge branch 'pr/n10_ardi69' into 0.4.10 (diff)
downloadpyload-2f8433b6a10505d29a1b63ea8bbd9b0bf3f7d9f6.tar.xz
Merge pull request #4 from vuolter/0.4.10
vuolter HEAD
Diffstat (limited to 'pyload/webui/app/json.py')
-rw-r--r--pyload/webui/app/json.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/pyload/webui/app/json.py b/pyload/webui/app/json.py
index 0805e9f5b..3b72cb7ce 100644
--- a/pyload/webui/app/json.py
+++ b/pyload/webui/app/json.py
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
+from __future__ import with_statement
+
from os.path import join
from traceback import print_exc
from shutil import copyfileobj
@@ -7,9 +9,7 @@ from shutil import copyfileobj
from bottle import route, request, HTTPError
from pyload.webui import PYLOAD
-
from pyload.webui.app.utils import login_required, render_to_response, toDict
-
from pyload.utils import decode, formatSize
@@ -166,9 +166,8 @@ def add_package():
name = f.name
fpath = join(PYLOAD.getConfigValue("general", "download_folder"), "tmp_" + f.filename)
- destination = open(fpath, 'wb')
- copyfileobj(f.file, destination)
- destination.close()
+ with open(fpath, 'wb') as destination:
+ copyfileobj(f.file, destination)
links.insert(0, fpath)
except Exception:
pass
@@ -226,7 +225,7 @@ def set_captcha():
if task.tid >= 0:
src = "data:image/%s;base64,%s" % (task.type, task.data)
- return {'captcha': True, 'id': task.tid, 'src': src, 'result_type' : task.resultType}
+ return {'captcha': True, 'id': task.tid, 'src': src, 'result_type': task.resultType}
else:
return {'captcha': False}
@@ -306,7 +305,6 @@ def update_accounts():
@route('/json/change_password', method='POST')
def change_password():
-
user = request.POST['user_login']
oldpw = request.POST['login_current_password']
newpw = request.POST['login_new_password']