diff options
Diffstat (limited to 'pyload/webui/app/cnl.py')
-rw-r--r-- | pyload/webui/app/cnl.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pyload/webui/app/cnl.py b/pyload/webui/app/cnl.py index 73087ad2d..b6cbd6b55 100644 --- a/pyload/webui/app/cnl.py +++ b/pyload/webui/app/cnl.py @@ -1,4 +1,7 @@ # -*- coding: utf-8 -*- + +from __future__ import with_statement + from os.path import join import re from urllib import unquote @@ -57,9 +60,8 @@ def addcrypted(): dlc = request.forms['crypted'].replace(" ", "+") dlc_path = join(DL_ROOT, package.replace("/", "").replace("\\", "").replace(":", "") + ".dlc") - dlc_file = open(dlc_path, "wb") - dlc_file.write(dlc) - dlc_file.close() + with open(dlc_path, "wb") as dlc_file: + dlc_file.write(dlc) try: PYLOAD.addPackage(package, [dlc_path], 0) |