Package turbogears :: Module errorhandling

Module errorhandling

source code

Functions
 
dispatch_error(controller, tg_source, tg_errors, tg_exceptions, *args, **kw)
Dispatch error.
source code
 
dispatch_error_adaptor(func)
Construct a signature isomorphic to dispatch_error.
source code
 
try_call(func, self, *args, **kw)
Call function, catch and dispatch any resulting exception.
source code
 
run_with_errors(errors, func, self, *args, **kw)
Branch execution depending on presence of errors.
source code
 
register_handler(handler=None, rules=None)
Register handler as an error handler for decorated method.
source code
 
dispatch_failsafe(schema, values, errors, source, kw)
Dispatch fail-safe mechanism for failed inputs.
source code
Variables
  error_handler = bind_rules("tg_errors")
  exception_handler = bind_rules("tg_exceptions")
  FailsafeSchema = Enum("none", "values", "map_errors", "defaults")
Function Details

dispatch_error(controller, tg_source, tg_errors, tg_exceptions, *args, **kw)

source code 

Dispatch error.

Error handler is a function registered via register_handler or if no such decorator was applied, the method triggering the error.

Decorators:
  • @abstract()

dispatch_error_adaptor(func)

source code 

Construct a signature isomorphic to dispatch_error.

The actual handler will receive only arguments explicitly declared, and a possible tg_format parameter.

register_handler(handler=None, rules=None)

source code 

Register handler as an error handler for decorated method.

If handler is not given, method is considered its own error handler.

rules can be a string containing an arbitrary logical Python expression to be used as dispatch rule allowing multiple error handlers for a single method.

register_handler decorator is an invariant.