Note
This feature is experimental.
Flatland can notify your code when events of interest occur during flatland processing. These signals can be used for advanced customization in your application or simply as a means for tracing and logging flatland activity during development.
To receive a signal, all you need is a function that can accept keyword arguments:
>>> def receiver(**kw):
... print "Look what I got!", kw
...
Receiving functions are connected to one or more signals you’d like to receive:
>>> from flatland import signals
>>> signals.validator_validated.connect(receiver)
That’s it. Now each time flatland runs a validator, the receiver function will be called and passed some information about the validation that just occured. There is no limit to the number of receivers connected to a signal.
Emitted after a validator has processed an element.
Parameters: |
|
---|
A generic notification emitter.
Connect receiver to signal events send by sender.
Parameters: |
|
---|
True if there is probably a receiver for sender.
Performs an optimistic check for receivers only. Does not guarantee that all weakly referenced receivers are still alive. See receivers_for() for a stronger search.
Emit this signal on behalf of sender, passing on **kwargs.
Returns a list of 2-tuples, pairing receivers with their return value. The ordering of receiver notification is undefined.