summaryrefslogtreecommitdiff
path: root/source3/python
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-05-16 07:32:55 +0000
committerTim Potter <tpot@samba.org>2002-05-16 07:32:55 +0000
commit535af3c3fe2bdac0f57729ea4aa01679314db10a (patch)
tree7739a0c658fedef524e31ca6dd22d7490de169f4 /source3/python
parent16f78e46bb6ded49ff908e48504473cae8530d29 (diff)
downloadsamba-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)
Diffstat (limited to 'source3/python')
-rw-r--r--source3/python/py_spoolss_forms.c27
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;