Fix formatting and add some black magic to @debug
This commit is contained in:
parent
5daba0f8ab
commit
b84b25db66
1 changed files with 9 additions and 6 deletions
|
|
@ -100,14 +100,17 @@ def debug(*args):
|
||||||
def wraper(function):
|
def wraper(function):
|
||||||
def print_debug(self, value):
|
def print_debug(self, value):
|
||||||
logger = getLogger('b2filters')
|
logger = getLogger('b2filters')
|
||||||
|
name = str(self)
|
||||||
|
result = "%s(%s" % (name, value)
|
||||||
logger.debug("Use the filter %s on %s" % (str(self), value))
|
logger.debug("Use the filter %s on %s" % (str(self), value))
|
||||||
env = ''
|
for arg in self.__dict__:
|
||||||
for arg in args:
|
if arg.startswith('_') or arg == u"selector":
|
||||||
env += "%s: %s;;; " % (arg, getattr(self, arg))
|
continue
|
||||||
if env != '':
|
result += ", %s=%s" % (arg, getattr(self, arg))
|
||||||
logger.debug(env)
|
result += u')'
|
||||||
|
logger.debug(result)
|
||||||
res = function(self, value)
|
res = function(self, value)
|
||||||
logger.debug("Result is: %s" % res)
|
logger.debug("------> %s" % res)
|
||||||
return res
|
return res
|
||||||
return print_debug
|
return print_debug
|
||||||
return wraper
|
return wraper
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue