summaryrefslogtreecommitdiffstats
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
commit608b9ab29dca820d29a40a2c5df86c1ff7e751a9 (patch)
tree85c890a8928a712606ddfedc9ef1c235b30deea8
parentc9c2aac9035a11e3fe2d320504097b98a426dd63 (diff)
downloadsamba-608b9ab29dca820d29a40a2c5df86c1ff7e751a9.tar.gz
samba-608b9ab29dca820d29a40a2c5df86c1ff7e751a9.tar.xz
samba-608b9ab29dca820d29a40a2c5df86c1ff7e751a9.zip
Add level field when converting FORM_1 to dict.
More error checking when converting from dict to FORM_1.
-rw-r--r--source/python/py_spoolss_forms_conv.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source/python/py_spoolss_forms_conv.c b/source/python/py_spoolss_forms_conv.c
index 2ded9afe91f..604777adcd4 100644
--- a/source/python/py_spoolss_forms_conv.c
+++ b/source/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;
}