X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=openerp%2Fexceptions.py;h=7789345585c5095bb16d83a024a9582e7fa73df3;hb=226b15415433247304b660cc8a932b8e41f253d9;hp=f99ed4330490642f8a61ffeb37a6638dcad842c4;hpb=64eedb68166a418ce355e3aa01c4d0bcba6cd39a;p=odoo%2Fodoo.git diff --git a/openerp/exceptions.py b/openerp/exceptions.py index f99ed43..7789345 100644 --- a/openerp/exceptions.py +++ b/openerp/exceptions.py @@ -25,31 +25,21 @@ This module defines a few exception types. Those types are understood by the RPC layer. Any other exception type bubbling until the RPC layer will be treated as a 'Server error'. +If you consider introducing new exceptions, check out the test_exceptions addon. """ -import re - class Warning(Exception): pass -class WarningConfig(Exception): - """ Warning bound to a misconfiguration. """ - def __init__(self, msg): - # 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) +class RedirectWarning(Exception): + """ Warning with a possibility to redirect the user instead of simply + diplaying the warning message. - 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) + Should receive as parameters: + :param int action_id: id of the action where to perform the redirection + :param string button_text: text to put on the button that will trigger + the redirection. + """ class AccessDenied(Exception): """ Login/password error. No message, no traceback. """