diff options
author | Tim Potter <tpot@samba.org> | 2002-05-16 07:32:55 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-05-16 07:32:55 +0000 |
commit | 535af3c3fe2bdac0f57729ea4aa01679314db10a (patch) | |
tree | 7739a0c658fedef524e31ca6dd22d7490de169f4 | |
parent | 16f78e46bb6ded49ff908e48504473cae8530d29 (diff) | |
download | samba-535af3c3fe2bdac0f57729ea4aa01679314db10a.tar.gz samba-535af3c3fe2bdac0f57729ea4aa01679314db10a.tar.bz2 samba-535af3c3fe2bdac0f57729ea4aa01679314db10a.zip |
Return enumerated forms as a hash of hashes instead of a list of hashes.
(This used to be commit 2f86f01b88ccaaeee97588f339ebaeae5c4c06e9)
-rw-r--r-- | source3/python/py_spoolss_forms.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/source3/python/py_spoolss_forms.c b/source3/python/py_spoolss_forms.c index 762b13f73b..b0fe43dd57 100644 --- a/source3/python/py_spoolss_forms.c +++ b/source3/python/py_spoolss_forms.c @@ -219,18 +219,29 @@ PyObject *spoolss_hnd_enumforms(PyObject *self, PyObject *args, PyObject *kw) return NULL; } - result = PyList_New(num_forms); + switch(level) { + case 1: + result = PyDict_New(); + + for (i = 0; i < num_forms; i++) { + PyObject *value; + fstring name; + + rpcstr_pull(name, forms[i].name.buffer, + sizeof(fstring), -1, STR_TERMINATE); - for (i = 0; i < num_forms; i++) { - PyObject *obj = NULL; + py_from_FORM_1(&value, &forms[i]); - switch(level) { - case 1: - py_from_FORM_1(&obj, &forms[i]); - break; + PyDict_SetItemString( + value, "level", PyInt_FromLong(1)); + + PyDict_SetItemString(result, name, value); } - PyList_SetItem(result, i, obj); + break; + default: + PyErr_SetString(spoolss_error, "unknown info level"); + return NULL; } return result; |