mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
65bace1765
* python/Makefile.am python/generator.py python/libvir.c python/libvir.py: improved python binding, raise exception when an instance creation or lookup fails, and add support for the global error handler, per conn handler still needed * python/tests/error.py python/tests/Makefile.am: adding a regression test Daniel
31 lines
936 B
Python
31 lines
936 B
Python
#!/usr/bin/python -u
|
|
#
|
|
# Those are the autogenerated Python bindings for libvirt.
|
|
# Check python/generator.py in the source distribution of libvir
|
|
# to find out more about the generation process
|
|
#
|
|
import libvirtmod
|
|
import types
|
|
|
|
# The root of all libxml2 errors.
|
|
class libvirtError(Exception):
|
|
pass
|
|
|
|
|
|
#
|
|
# register the libvirt global error handler
|
|
#
|
|
def registerErrorHandler(f, ctx):
|
|
"""Register a Python written function to for error reporting.
|
|
The function is called back as f(ctx, error), with error
|
|
being a list of informations about the error being raised.
|
|
Returns 1 in case of success."""
|
|
return libvirtmod.virRegisterErrorHandler(f,ctx)
|
|
|
|
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
|
#
|
|
# Everything before this line comes from libvir.py
|
|
# Everything after this line is automatically generated
|
|
#
|
|
# WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|