diff options
author | ardi69 <armin@diedering.de> | 2015-04-21 06:51:24 +0200 |
---|---|---|
committer | ardi69 <armin@diedering.de> | 2015-04-21 06:51:24 +0200 |
commit | 2f8433b6a10505d29a1b63ea8bbd9b0bf3f7d9f6 (patch) | |
tree | b82a8b5fc0a309f69733b0a004284f4ef45833d8 /pyload/config | |
parent | added check of classname == filename (diff) | |
parent | Merge branch 'pr/n10_ardi69' into 0.4.10 (diff) | |
download | pyload-2f8433b6a10505d29a1b63ea8bbd9b0bf3f7d9f6.tar.xz |
Merge pull request #4 from vuolter/0.4.10
vuolter HEAD
Diffstat (limited to 'pyload/config')
-rw-r--r-- | pyload/config/Parser.py | 27 | ||||
-rw-r--r-- | pyload/config/Setup.py | 6 | ||||
-rw-r--r-- | pyload/config/default.conf | 2 |
3 files changed, 15 insertions, 20 deletions
diff --git a/pyload/config/Parser.py b/pyload/config/Parser.py index 1d76c0164..45fb1c8d0 100644 --- a/pyload/config/Parser.py +++ b/pyload/config/Parser.py @@ -52,29 +52,26 @@ class ConfigParser(object): copy(join(pypath, "pyload", "config", "default.conf"), "pyload.conf") if not exists("plugin.conf"): - f = open("plugin.conf", "wb") - f.write("version: " + str(CONF_VERSION)) - f.close() + with open("plugin.conf", "wb") as f: + f.write("version: " + str(CONF_VERSION)) - f = open("pyload.conf", "rb") - v = f.readline() - f.close() + with open("pyload.conf", "rb") as f: + v = f.readline() v = v[v.find(":") + 1:].strip() if not v or int(v) < CONF_VERSION: copy(join(pypath, "pyload", "config", "default.conf"), "pyload.conf") print "Old version of config was replaced" - f = open("plugin.conf", "rb") - v = f.readline() - f.close() + with open("plugin.conf", "rb") as f: + v = f.readline() v = v[v.find(":") + 1:].strip() if not v or int(v) < CONF_VERSION: - f = open("plugin.conf", "wb") - f.write("version: " + str(CONF_VERSION)) - f.close() + with open("plugin.conf", "wb") as f: + f.write("version: " + str(CONF_VERSION)) print "Old version of plugin-config replaced" + except Exception: if n >= 3: raise @@ -104,9 +101,8 @@ class ConfigParser(object): def parseConfig(self, config): """parses a given configfile""" - f = open(config) - - config = f.read() + with open(config) as f: + config = f.read() config = config.splitlines()[1:] @@ -183,7 +179,6 @@ class ConfigParser(object): print "Config Warning" print_exc() - f.close() return conf diff --git a/pyload/config/Setup.py b/pyload/config/Setup.py index ce5a5fb88..bae75fea4 100644 --- a/pyload/config/Setup.py +++ b/pyload/config/Setup.py @@ -32,9 +32,9 @@ class SetupAssistant(object): load_translation("setup", self.lang) - #Input shorthand for yes + # Input shorthand for yes self.yes = _("y") - #Input shorthand for no + # Input shorthand for no self.no = _("n") # print @@ -261,7 +261,7 @@ class SetupAssistant(object): web = sqlite and beaker - js = True if JsEngine.find() else False + js = bool(JsEngine.find()) self.print_dep(_("JS engine"), js) if not python: diff --git a/pyload/config/default.conf b/pyload/config/default.conf index e07b92f68..b36ed6c9c 100644 --- a/pyload/config/default.conf +++ b/pyload/config/default.conf @@ -1,4 +1,4 @@ -version: 2 +version: 1 remote - "Remote": bool activated : "Activated" = True |