We have committed the callback code to openacs.
the ad_proc documentation includes the
-callback and -impl flags and the documentation for
the "callback" function is
callback [ -catch ] [ -impl impl ] callback [ args... ]
Defined in packages/acs-bootstrap-installer/tcl/00-proc-procs.tclInvoke the registered callback implementations for the given
callback. The callbacks terminate on error unless -catch
is provided. The value returned by the callback function is
determined by the return codes from the callback implementations.
The return codes returned from the implmentation are treated
as follows:
- return -code ok or "return"
- With a plain return, a non-empty return value will be lappended to
the list of returns from the callback function
- return -code error or "error"
- errors will simply propigate (and no value returned) unless -catch
is specified in which case the callback processing will continue but
no value will be appended to the return list for the implementation
which returned an error.
- return -code return
- Takes the return value if the implementation returning -code return
and returns a one element list with that return value. Note that this means
if you have code which returns
return -code return {x y}
,
you will get {{x y}} as the return value from the callback. This is
done in order to unambiguously distinguish a pair of callbacks returning
x and y respectively from this single callback.
- return -code break
- return the current list of returned values including this implementations
return value if non-empty
- return -code continue
- Continue processing, ignore the return value from this implementation
- Switches:
- -catch (boolean) (optional)
- if catch specified errors in the callback will be caught, tracebacks
logged as errors to the server log, but other callbacks called and the
list of returns still returned. If not given an error simply is passed
further on.
- -impl (defaults to
"*"
) (optional) - invoke a specific implemenation rather than all implementations
of the given callback
- Parameters:
-
callback - the callback name without leading or trailing ::
- Returns:
- list of the returns from each callback that does a normal (non-empty) return
Lee Denison wrote reasonably comprehensive tests for the
API and we will be committing some examples shortly.
Head installs after these changes and everything seems to
work just fine.