summaryrefslogtreecommitdiff
path: root/source3/python/py_spoolss_printers.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-05-17 02:39:07 +0000
committerTim Potter <tpot@samba.org>2002-05-17 02:39:07 +0000
commit4f783edcf3a01572589866031fa312316a703a34 (patch)
tree727992bd0a03b28227c925dc07a24adf7ae4fe79 /source3/python/py_spoolss_printers.c
parent296583a5e1fc6eb58c14863855e652416983e7a4 (diff)
downloadsamba-4f783edcf3a01572589866031fa312316a703a34.tar.gz
samba-4f783edcf3a01572589866031fa312316a703a34.tar.bz2
samba-4f783edcf3a01572589866031fa312316a703a34.zip
Use get_level_value() utility fn.
Cleaned up some local variable naming. (This used to be commit d4c7a85c2b5c45f1cc3273230d80a1d5923cd848)
Diffstat (limited to 'source3/python/py_spoolss_printers.c')
-rw-r--r--source3/python/py_spoolss_printers.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/source3/python/py_spoolss_printers.c b/source3/python/py_spoolss_printers.c
index 2edad20fda..54ea54682d 100644
--- a/source3/python/py_spoolss_printers.c
+++ b/source3/python/py_spoolss_printers.c
@@ -177,7 +177,7 @@ PyObject *spoolss_hnd_setprinter(PyObject *self, PyObject *args, PyObject *kw)
{
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
WERROR werror;
- PyObject *info, *level_obj;
+ PyObject *info;
PRINTER_INFO_CTR ctr;
uint32 level;
static char *kwlist[] = {"dict", NULL};
@@ -192,28 +192,13 @@ PyObject *spoolss_hnd_setprinter(PyObject *self, PyObject *args, PyObject *kw)
args, kw, "O!", kwlist, &PyDict_Type, &info))
return NULL;
- /* Check dictionary contains a level */
-
- if ((level_obj = PyDict_GetItemString(info, "level"))) {
-
- if (!PyInt_Check(level_obj)) {
- PyErr_SetString(spoolss_error,
- "level not an integer");
- return NULL;
- }
-
- level = PyInt_AsLong(level_obj);
-
- /* Only level 2, 3 supported by NT */
-
- if (level != 2 && level != 3) {
- PyErr_SetString(spoolss_error,
- "unsupported info level");
- return NULL;
- }
+ if (!get_level_value(info, &level)) {
+ PyErr_SetString(spoolss_error, "invalid info level");
+ return NULL;
+ }
- } else {
- PyErr_SetString(spoolss_error, "no info level present");
+ if (level != 2 && level != 3) {
+ PyErr_SetString(spoolss_error, "unsupported info level");
return NULL;
}