[IMP] add a new test for the new exception type

bzr revid: abo@openerp.com-20130201171742-axfcg7y99uxpersw
This commit is contained in:
Antonin Bourguignon 2013-02-01 18:17:42 +01:00
parent 8d5340a27d
commit 195be49479
3 changed files with 10 additions and 0 deletions

View File

@ -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 RPC layer. Any other exception type bubbling until the RPC layer will be
treated as a 'Server error'. treated as a 'Server error'.
If you consider introducing new exceptions, check out the test_exceptions
addon.
""" """
class Warning(Exception): class Warning(Exception):

View File

@ -19,6 +19,9 @@ class m(openerp.osv.osv.Model):
def generate_warning(self, cr, uid, ids, context=None): def generate_warning(self, cr, uid, ids, context=None):
raise openerp.exceptions.Warning('description') 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): def generate_access_denied(self, cr, uid, ids, context=None):
raise openerp.exceptions.AccessDenied() raise openerp.exceptions.AccessDenied()
@ -30,4 +33,5 @@ class m(openerp.osv.osv.Model):
def generate_undefined(self, cr, uid, ids, context=None): def generate_undefined(self, cr, uid, ids, context=None):
self.surely_undefined_symbol self.surely_undefined_symbol
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -21,6 +21,10 @@
<button name="generate_warning" string="Warning" type="object" icon="gtk-ok" colspan="1"/> <button name="generate_warning" string="Warning" type="object" icon="gtk-ok" colspan="1"/>
<label string="Warning-description"/> <label string="Warning-description"/>
</group> </group>
<group colspan="8" col="8">
<button name="generate_redirect_warning" string="RedirectWarning" type="object" icon="gtk-ok" colspan="1"/>
<label string="Warning-description-redirection button"/>
</group>
<group colspan="8" col="8"> <group colspan="8" col="8">
<button name="generate_access_denied" string="AccessDenied" type="object" icon="gtk-ok" colspan="1"/> <button name="generate_access_denied" string="AccessDenied" type="object" icon="gtk-ok" colspan="1"/>
<label string="Access denied-traceback"/> <label string="Access denied-traceback"/>