X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=openerp%2Fexceptions.py;h=fbf52c7f3a9bab66d56f2bccbaf8974ecb5420d3;hb=afb2735412023df7e4e967699332b76e5eea17d3;hp=944e34fb3ef73910c5c35c10556e0061889336d6;hpb=157580b8e8ac9735887cbc12d1e3efcf368cb70a;p=odoo%2Fodoo.git diff --git a/openerp/exceptions.py b/openerp/exceptions.py index 944e34f..fbf52c7 100644 --- a/openerp/exceptions.py +++ b/openerp/exceptions.py @@ -19,18 +19,38 @@ # ############################################################################## +""" OpenERP core exceptions. + +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'. + +""" + class Warning(Exception): pass 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): """ Access rights error. """ +class DeferredException(Exception): + """ Exception object holding a traceback for asynchronous reporting. + + Some RPC calls (database creation and report generation) happen with + an initial request followed by multiple, polling requests. This class + is used to store the possible exception occuring in the thread serving + the first request, and is then sent to a polling request. + + ('Traceback' is misleading, this is really a exc_info() triple.) + """ + def __init__(self, msg, tb): + self.message = msg + self.traceback = tb # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: