Skip to content

Commit 195be49

Browse files
author
Antonin Bourguignon
committed
[IMP] add a new test for the new exception type
bzr revid: [email protected]
1 parent 8d5340a commit 195be49

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

openerp/exceptions.py

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
RPC layer. Any other exception type bubbling until the RPC layer will be
2626
treated as a 'Server error'.
2727
28+
If you consider introducing new exceptions, check out the test_exceptions
29+
addon.
2830
"""
2931

3032
class Warning(Exception):

openerp/tests/addons/test_exceptions/models.py

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ def generate_except_orm(self, cr, uid, ids, context=None):
1919
def generate_warning(self, cr, uid, ids, context=None):
2020
raise openerp.exceptions.Warning('description')
2121

22+
def generate_redirect_warning(self, cr, uid, ids, context=None):
23+
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')
24+
2225
def generate_access_denied(self, cr, uid, ids, context=None):
2326
raise openerp.exceptions.AccessDenied()
2427

@@ -30,4 +33,5 @@ def generate_exc_access_denied(self, cr, uid, ids, context=None):
3033

3134
def generate_undefined(self, cr, uid, ids, context=None):
3235
self.surely_undefined_symbol
36+
3337
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

openerp/tests/addons/test_exceptions/view.xml

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
<button name="generate_warning" string="Warning" type="object" icon="gtk-ok" colspan="1"/>
2222
<label string="Warning-description"/>
2323
</group>
24+
<group colspan="8" col="8">
25+
<button name="generate_redirect_warning" string="RedirectWarning" type="object" icon="gtk-ok" colspan="1"/>
26+
<label string="Warning-description-redirection button"/>
27+
</group>
2428
<group colspan="8" col="8">
2529
<button name="generate_access_denied" string="AccessDenied" type="object" icon="gtk-ok" colspan="1"/>
2630
<label string="Access denied-traceback"/>

0 commit comments

Comments
 (0)