summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-05-17 02:34:49 +0000
committerTim Potter <tpot@samba.org>2002-05-17 02:34:49 +0000
commit296583a5e1fc6eb58c14863855e652416983e7a4 (patch)
tree7c0370d1428f8874a7ba9731c91b21b83851d172
parent281ded3f7fdb9174bbfe264328c1a43269a66f33 (diff)
downloadsamba-296583a5e1fc6eb58c14863855e652416983e7a4.tar.gz
samba-296583a5e1fc6eb58c14863855e652416983e7a4.tar.bz2
samba-296583a5e1fc6eb58c14863855e652416983e7a4.zip
Add level field when converting FORM_1 to dict.
More error checking when converting from dict to FORM_1. (This used to be commit 608b9ab29dca820d29a40a2c5df86c1ff7e751a9)
-rw-r--r--source3/python/py_spoolss_forms_conv.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source3/python/py_spoolss_forms_conv.c b/source3/python/py_spoolss_forms_conv.c
index 2ded9afe91..604777adcd 100644
--- a/source3/python/py_spoolss_forms_conv.c
+++ b/source3/python/py_spoolss_forms_conv.c
@@ -47,11 +47,27 @@ struct pyconv py_FORM_1[] = {
BOOL py_from_FORM_1(PyObject **dict, FORM_1 *form)
{
*dict = from_struct(form, py_FORM_1);
+
+ PyDict_SetItemString(*dict, "level", PyInt_FromLong(1));
+
return True;
}
BOOL py_to_FORM(FORM *form, PyObject *dict)
{
- to_struct(form, dict, py_FORM);
+ PyObject *obj;
+ char *name;
+
+ if (!to_struct(form, dict, py_FORM))
+ return False;
+
+ if (!(obj = PyDict_GetItemString(dict, "name")) ||
+ !PyString_Check(obj))
+ return False;
+
+ name = PyString_AsString(obj);
+
+ init_unistr2(&form->name, name, strlen(name) + 1);
+
return True;
}