From a4af8609686386d3371289ea24e019a897ca13bd Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Thu, 31 Jan 2013 19:15:20 +0100 Subject: [PATCH] [IMP] introduce a new kind of exception: RedirectWarning (warning with an additional redirection button) bzr revid: abo@openerp.com-20130131181520-q5ol3ngsn93u7hg5 --- openerp/exceptions.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/openerp/exceptions.py b/openerp/exceptions.py index fbf52c7f3a9..46f0a29b1e0 100644 --- a/openerp/exceptions.py +++ b/openerp/exceptions.py @@ -30,6 +30,19 @@ treated as a 'Server error'. class Warning(Exception): pass +class RedirectWarning(Exception): + """ Warning with a possibility to redirect the user instead of simply + discarding the warning message. + """ + def __init__(self, msg, action_id, button_text): + """ + :param int action_id: id of the action required to perform the + redirection + :param string button_text: text to put on the button which will trigger + the redirection + """ + super(RedirectWarning, self).__init__(msg, action_id, button_text) + class AccessDenied(Exception): """ Login/password error. No message, no traceback. """ def __init__(self):