X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=openerp%2Fexceptions.py;h=7789345585c5095bb16d83a024a9582e7fa73df3;hb=993bff902e22ab77b7a36d3f48ed12511e93e2b1;hp=50571306d29c17b94873d5f67aa3b18630a8863b;hpb=08cfadaff074703cf480051a1351f851fcaf477f;p=odoo%2Fodoo.git diff --git a/openerp/exceptions.py b/openerp/exceptions.py index 5057130..7789345 100644 --- a/openerp/exceptions.py +++ b/openerp/exceptions.py @@ -25,16 +25,26 @@ 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. """ class Warning(Exception): pass +class RedirectWarning(Exception): + """ Warning with a possibility to redirect the user instead of simply + diplaying the warning message. + + 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. """ def __init__(self): - import random - super(AccessDenied, self).__init__('Try again. %s out of %s characters are correct.' % (random.randint(0, 30), 30)) + super(AccessDenied, self).__init__('Access denied.') self.traceback = ('', '', '') class AccessError(Exception): @@ -53,6 +63,5 @@ class DeferredException(Exception): def __init__(self, msg, tb): self.message = msg self.traceback = tb - self.args = (msg, tb) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: