[PATCH 1/2] Add support for callbacks providing additional data

Brian C. Lane bcl at redhat.com
Sat Jan 12 01:03:38 UTC 2013


On Fri, Jan 11, 2013 at 09:07:16PM +0100, Vratislav Podzimek wrote:
> We provide a way to register files that should be appended to the data
> collected about the crash. This patch adds the similar functionality,
> but for the callbacks (calling programs, listing items in some additional
> object, etc.).
> 
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
>  meh/__init__.py    | 35 +++++++++++++++++++++++++++++++++++
>  meh/dump.py        |  8 ++++++++
>  meh/handler.py     |  7 +++++++
>  tests/callbacks.py | 38 ++++++++++++++++++++++++++++++++++++++
>  4 files changed, 88 insertions(+)
>  create mode 100644 tests/callbacks.py


> +
> +    def register_callback(self, item_name, callback):
> +        """
> +        Register new callback that will be called when data about the
> +        crash is collected. The returned value will be included as the
> +        'item_name' item.
> +
> +        @param item_name: name of the item storing the value returned by the
> +                          'callback' function
> +        @type item_name: string
> +        @param callback: a function to be called
> +        @type callback: a function of type: () -> string
> +        @raise ConfigError: if callback with the 'item_name' has already been
> +                            registered
> +        @return: None
> +
> +        """

I'm not sure if it would ever be useful but maybe add the option to
replace the callback?

Looks good though.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/anaconda-patches/attachments/20130111/632b0e4d/attachment.sig>


More information about the anaconda-patches mailing list