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 9 and Version 10 of HowDoesErrorHandlingWork


Ignore:
Timestamp:
02/22/06 16:44:53 (13 years ago)
Author:
simon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowDoesErrorHandlingWork

    v9 v10  
    7171Predefined schemas (see turbogears/errorhandling.py): 
    7272 
    73 * ''!FailsafeSchema.none'': Default. No conversions are preformed, input remains as is: 
    74 {{{ 
    75 @validate(validators={...}) 
    76 }}} 
    77 or explicitly: 
    78 {{{ 
    79 @validate(validators={...}, failsafe_scheme=errorhandling.FailsafeSchema.none) 
    80 }}} 
    81 ''failsafe_values'' is ignored. 
     73 * ''!FailsafeSchema.none'': Default. No conversions are preformed, input remains as is: 
     74 {{{ 
     75 @validate(validators={...}) 
     76 }}} 
     77 or explicitly: 
     78 {{{ 
     79 @validate(validators={...}, failsafe_scheme=errorhandling.FailsafeSchema.none) 
     80 }}} 
     81 ''failsafe_values'' is ignored. 
     82 * ''!FailsafeSchema.values'': If ''failsafe_values'' is a dict, every input for which exists a key in ''failsafe_values'' is replaced with corresponding value. Otherwise all erroneous inputs are replaced with (same instance of!) ''failsafe_values''. 
     83 {{{ 
     84 @validate(validators={"bar":validators.Int(), "baz":validators.Int()}, failsafe_schema=FailsafeSchema.values, failsafe_values={"bar":1, "baz":2}) 
     85 }}} 
     86 If erroneous, bar is set to (int) 1, while baz to 2. 
     87 {{{ 
     88 @validate(validators={"bar":validators.Int(), "baz":validators.Int()}, failsafe_schema=FailsafeSchema.values, failsafe_values=13) 
     89 }}} 
     90 Both bar and baz are set to 13 when erroneous. 
    8291 
    83 * ''!FailsafeSchema.values'': If ''failsafe_values'' is a dict, every input for which exists a key in ''failsafe_values'' is replaced with corresponding value. Otherwise all erroneous inputs are replaced with (same instance of!) ''failsafe_values''. 
    84 {{{ 
    85 @validate(validators={"bar":validators.Int(), "baz":validators.Int()}, failsafe_schema=FailsafeSchema.values, failsafe_values={"bar":1, "baz":2}) 
    86 }}} 
    87 If erroneous, bar is set to (int) 1, while baz to 2. 
    88 {{{ 
    89 @validate(validators={"bar":validators.Int(), "baz":validators.Int()}, failsafe_schema=FailsafeSchema.values, failsafe_values=13) 
    90 }}} 
    91 Both bar and baz are set to 13 when erroneous. 
    92  
    93 * ''!FailsafeSchema.map_errors'': Inputs are mapped to corresponding exceptions.  
    94 {{{ 
    95 @validate(validators={"bar":validators.Int(), "baz":validators.Int()}, failsafe_schema=FailsafeSchema.map_errors) 
    96 }}} 
    97 ''failsafe_values'' is ignored. 
     92 * ''!FailsafeSchema.map_errors'': Inputs are mapped to corresponding exceptions.  
     93 {{{ 
     94 @validate(validators={"bar":validators.Int(), "baz":validators.Int()}, failsafe_schema=FailsafeSchema.map_errors) 
     95 }}} 
     96 ''failsafe_values'' is ignored. 
    9897 
    9998User defined schemas can be added by defining new specialisations for generic function ''errorhandling.dispatch_failsafe''.