Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Changes between Version 14 and Version 15 of HowDoesErrorHandlingWork


Ignore:
Timestamp:
03/18/06 10:58:55 (13 years ago)
Author:
simon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowDoesErrorHandlingWork

    v14 v15  
    3838@error_handler() 
    3939}}} 
    40 or by declaring parameter tg_errors: 
     40Care should be taken with this approach as it can introduce subtle bugs. Consider the following example: 
     41{{{ 
     42@expose() 
     43@validate(...) 
     44@identity.require(...) 
     45@error_handler() 
     46def foo(self, bar=None, baz=None): 
     47}}} 
     48Whenever validation fails '''''identity.require'' will be by-passed'''! This happens because the function '''as it was at decoration time''' is registered as error handler.  
     49 
     50A safer alternative is to for the method do declare parameter tg_errors: 
    4151{{{ 
    4252def foo(self, bar=None, tg_errors=None):