From b84b25db6630c5cc7f34b6073e2748da74cd0704 Mon Sep 17 00:00:00 2001 From: Florent Date: Sat, 27 Sep 2014 15:41:12 +0200 Subject: [PATCH] Fix formatting and add some black magic to @debug --- weboob/tools/browser2/filters/standard.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/weboob/tools/browser2/filters/standard.py b/weboob/tools/browser2/filters/standard.py index 6ab7e53d..050d9140 100644 --- a/weboob/tools/browser2/filters/standard.py +++ b/weboob/tools/browser2/filters/standard.py @@ -100,14 +100,17 @@ def debug(*args): def wraper(function): def print_debug(self, value): logger = getLogger('b2filters') + name = str(self) + result = "%s(%s" % (name, value) logger.debug("Use the filter %s on %s" % (str(self), value)) - env = '' - for arg in args: - env += "%s: %s;;; " % (arg, getattr(self, arg)) - if env != '': - logger.debug(env) + for arg in self.__dict__: + if arg.startswith('_') or arg == u"selector": + continue + result += ", %s=%s" % (arg, getattr(self, arg)) + result += u')' + logger.debug(result) res = function(self, value) - logger.debug("Result is: %s" % res) + logger.debug("------> %s" % res) return res return print_debug return wraper