From 195be49479f93239849cd18c8807425e1fc983e7 Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Fri, 1 Feb 2013 18:17:42 +0100 Subject: [PATCH] [IMP] add a new test for the new exception type bzr revid: abo@openerp.com-20130201171742-axfcg7y99uxpersw --- openerp/exceptions.py | 2 ++ openerp/tests/addons/test_exceptions/models.py | 4 ++++ openerp/tests/addons/test_exceptions/view.xml | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/openerp/exceptions.py b/openerp/exceptions.py index 46f0a29b1e0..41fff85010c 100644 --- a/openerp/exceptions.py +++ b/openerp/exceptions.py @@ -25,6 +25,8 @@ 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): diff --git a/openerp/tests/addons/test_exceptions/models.py b/openerp/tests/addons/test_exceptions/models.py index 03788159bf8..78f0e182b48 100644 --- a/openerp/tests/addons/test_exceptions/models.py +++ b/openerp/tests/addons/test_exceptions/models.py @@ -19,6 +19,9 @@ class m(openerp.osv.osv.Model): def generate_warning(self, cr, uid, ids, context=None): raise openerp.exceptions.Warning('description') + def generate_redirect_warning(self, cr, uid, ids, context=None): + raise openerp.exceptions.RedirectWarning('description', self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'action_client_base_menu'), 'go to the redirection') + def generate_access_denied(self, cr, uid, ids, context=None): raise openerp.exceptions.AccessDenied() @@ -30,4 +33,5 @@ class m(openerp.osv.osv.Model): def generate_undefined(self, cr, uid, ids, context=None): self.surely_undefined_symbol + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/openerp/tests/addons/test_exceptions/view.xml b/openerp/tests/addons/test_exceptions/view.xml index 180029e739a..0c8e373a278 100644 --- a/openerp/tests/addons/test_exceptions/view.xml +++ b/openerp/tests/addons/test_exceptions/view.xml @@ -21,6 +21,10 @@