From 64eedb68166a418ce355e3aa01c4d0bcba6cd39a Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Fri, 18 Jan 2013 18:16:19 +0100 Subject: [PATCH] [WIP] start the implementation of WarningConfig bzr revid: abo@openerp.com-20130118171619-dx0yjwuun0j7m43p --- openerp/exceptions.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/openerp/exceptions.py b/openerp/exceptions.py index 387e126b8c4..f99ed433049 100644 --- a/openerp/exceptions.py +++ b/openerp/exceptions.py @@ -35,7 +35,20 @@ class Warning(Exception): class WarningConfig(Exception): """ Warning bound to a misconfiguration. """ def __init__(self, msg): - # todo: treat the msg (regex) + # WIP WIP WIP WIP WIP WIP WIP + def sub_path(g): + menu_xml_id = g.group(1) + + return '(group to convert: '+menu_xml_id+')' + + def sub_path(g): + menu_xml_id = g.group(1) + + return '(group to convert: '+menu_xml_id+')' + + # Treat the msg: find the menu_xml_id and the field_name + teststr = 'coucou [path:blabla_bla_bla]' + print ">>>>> sub: ", re.sub(r'\[path:([a-z_]*)\]', sub_path, teststr) super(WarningConfig, self).__init__(msg) class AccessDenied(Exception):