From 2deaf64acf3afba168ef85e7dd75578f22b9b2e7 Mon Sep 17 00:00:00 2001 From: Armin Date: Sat, 18 Apr 2015 15:03:47 +0200 Subject: fix: color_logger revert partially Spare code cosmetics (1) to fix SyntaxError: duplicate argument 'section' in function definition --- pyload/Core.py | 8 ++++---- pyload/api/__init__.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pyload/Core.py b/pyload/Core.py index e6f6fefcb..f723d8366 100755 --- a/pyload/Core.py +++ b/pyload/Core.py @@ -518,7 +518,7 @@ class Core(object): 'CRITICAL': "purple" } - console_frm = colorlog.ColoredFormatter(format=c_fmt, + console_frm = colorlog.ColoredFormatter(fmt=c_fmt, datefmt=date_fmt, log_colors=clr, secondary_log_colors=extra_clr) @@ -596,7 +596,7 @@ class Core(object): if not file_exists and not quiet: if file_created: - #self.log.info( _("%s created") % description ) + #self.log.info( _("%s created") % description ) pass else: if not empty: @@ -674,7 +674,7 @@ def deamon(): try: pid = os.fork() if pid > 0: - # exit from second parent, print eventual PID before + # exit from second parent, print eventual PID before print "Daemon PID %d" % pid sys.exit(0) except OSError, e: @@ -698,7 +698,7 @@ def deamon(): def main(): if "--daemon" in sys.argv: - deamon() + deamon() else: pyload_core = Core() try: diff --git a/pyload/api/__init__.py b/pyload/api/__init__.py index 62af70cf8..b5c1dfbf4 100644 --- a/pyload/api/__init__.py +++ b/pyload/api/__init__.py @@ -120,23 +120,23 @@ class Api(Iface): @permission(PERMS.SETTINGS) - def getConfigValue(self, section, option, section="core"): + def getConfigValue(self, category, option, section="core"): """Retrieve config value. - :param section: name of section, or plugin + :param category: name of category, or plugin :param option: config option :param section: 'plugin' or 'core' :return: config value as string """ if section == "core": - value = self.core.config.get(section, option) + value = self.core.config[category][option] else: - value = self.core.config.getPlugin(section, option) + value = self.core.config.getPlugin(category, option) return str(value) @permission(PERMS.SETTINGS) - def setConfigValue(self, section, option, value, section="core"): + def setConfigValue(self, category, option, value, section="core"): """Set new config value. :param section: @@ -144,13 +144,13 @@ class Api(Iface): :param value: new config value :param section: 'plugin' or 'core """ - self.core.addonManager.dispatchEvent("config-changed", section, option, value, section) + self.core.addonManager.dispatchEvent("config-changed", category, option, value, section) if section == "core": - self.core.config.set(section, option, value) + self.core.config[category][option] = value if option in ("limit_speed", "max_speed"): # not so nice to update the limit self.core.requestFactory.updateBucket() elif section == "plugin": - self.core.config.setPlugin(section, option, value) + self.core.config.setPlugin(category, option, value) @permission(PERMS.SETTINGS) -- cgit v1.2.3