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 | 2f86f01b88ccaaeee97588f339ebaeae5c4c06e9 (patch) | |
tree | 3b095bee3651e7af3b047efb37037f74659c172b /source/python/py_spoolss_forms.c | |
parent | 8d2f77ce956711f2afbadbeee50d82fbec9047dc (diff) | |
download | samba-2f86f01b88ccaaeee97588f339ebaeae5c4c06e9.tar.gz samba-2f86f01b88ccaaeee97588f339ebaeae5c4c06e9.tar.xz samba-2f86f01b88ccaaeee97588f339ebaeae5c4c06e9.zip |
Return enumerated forms as a hash of hashes instead of a list of hashes.
Diffstat (limited to 'source/python/py_spoolss_forms.c')
-rw-r--r-- | source/python/py_spoolss_forms.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/source/python/py_spoolss_forms.c b/source/python/py_spoolss_forms.c index 762b13f73be..b0fe43dd574 100644 --- a/source/python/py_spoolss_forms.c +++ b/source/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; |