From a236a3ac75f58bec71598c0144a2417f6459ee18 Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Wed, 18 Jan 2012 12:49:10 +0100 Subject: [PATCH] [IMP] tools: removed deprecated debug() function. bzr revid: vmt@openerp.com-20120118114910-xrynwguzu0e5zsng --- openerp/tools/misc.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/openerp/tools/misc.py b/openerp/tools/misc.py index 67e4fd6e655..6739f45cc5a 100644 --- a/openerp/tools/misc.py +++ b/openerp/tools/misc.py @@ -731,40 +731,6 @@ class profile(object): return wrapper -def debug(what): - """ - This method allow you to debug your code without print - Example: - >>> def func_foo(bar) - ... baz = bar - ... debug(baz) - ... qnx = (baz, bar) - ... debug(qnx) - ... - >>> func_foo(42) - - This will output on the logger: - - [Wed Dec 25 00:00:00 2008] DEBUG:func_foo:baz = 42 - [Wed Dec 25 00:00:00 2008] DEBUG:func_foo:qnx = (42, 42) - - To view the DEBUG lines in the logger you must start the server with the option - --log-level=debug - - """ - warnings.warn("The tools.debug() method is deprecated, please use logging.", - DeprecationWarning, stacklevel=2) - from inspect import stack - from pprint import pformat - st = stack()[1] - param = re.split("debug *\((.+)\)", st[4][0].strip())[1].strip() - while param.count(')') > param.count('('): param = param[:param.rfind(')')] - what = pformat(what) - if param != what: - what = "%s = %s" % (param, what) - logging.getLogger(st[3]).debug(what) - - __icons_list = ['STOCK_ABOUT', 'STOCK_ADD', 'STOCK_APPLY', 'STOCK_BOLD', 'STOCK_CANCEL', 'STOCK_CDROM', 'STOCK_CLEAR', 'STOCK_CLOSE', 'STOCK_COLOR_PICKER', 'STOCK_CONNECT', 'STOCK_CONVERT', 'STOCK_COPY', 'STOCK_CUT', 'STOCK_DELETE',