python: Let RHashtable be returned as a Python dict.

The initial proposal was suggested by Matt Booth and discussed on the
mailing list here:

https://www.redhat.com/archives/libguestfs/2013-April/msg00007.html
This commit is contained in:
Richard W.M. Jones
2013-04-03 18:58:43 +01:00
parent 3dcb572bda
commit ba0199c487
10 changed files with 103 additions and 26 deletions

View File

@@ -7,7 +7,7 @@ guestfs-python - How to use libguestfs from Python
=head1 SYNOPSIS
import guestfs
g = guestfs.GuestFS ()
g = guestfs.GuestFS (python_return_dict=True)
g.add_drive_opts ("disk.img", format="raw", readonly=1)
g.launch ()
@@ -18,6 +18,17 @@ programming language. This page just documents the differences from
the C API and gives some examples. If you are not familiar with using
libguestfs, you also need to read L<guestfs(3)>.
=head2 python_return_dict=True
All new code should construct the handle using:
g = guestfs.GuestFS (python_return_dict=True)
This indicates that your program wants to receive Python dicts for
methods in the API that return hashtables.
In a future version of libguestfs, this will become the default.
=head2 EXCEPTIONS
Errors from libguestfs functions are mapped into C<RuntimeException>