diff options
author | Tim Potter <tpot@samba.org> | 2002-05-01 04:25:46 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-05-01 04:25:46 +0000 |
commit | e8e866867e08c3784e379682325501972795bf4b (patch) | |
tree | 332e20d2050520d5c4c9965beb9f6867c0363eb4 /source3/python | |
parent | 451b5feeb72771a64181ad07e08fff865872fd3e (diff) | |
download | samba-e8e866867e08c3784e379682325501972795bf4b.tar.gz samba-e8e866867e08c3784e379682325501972795bf4b.tar.bz2 samba-e8e866867e08c3784e379682325501972795bf4b.zip |
Got setprinter level 3 working!
Replaced some DEBUG's with PyErr_SetString() calls.
(This used to be commit 0f464fc79118161a97f45f428e4da1069a0be23d)
Diffstat (limited to 'source3/python')
-rw-r--r-- | source3/python/py_spoolss_printers.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/source3/python/py_spoolss_printers.c b/source3/python/py_spoolss_printers.c index 623e693124..b006e54d81 100644 --- a/source3/python/py_spoolss_printers.c +++ b/source3/python/py_spoolss_printers.c @@ -203,8 +203,9 @@ PyObject *spoolss_setprinter(PyObject *self, PyObject *args, PyObject *kw) if ((level_obj = PyDict_GetItemString(info, "level"))) { if (!PyInt_Check(level_obj)) { - DEBUG(0, ("** level not an integer\n")); - goto error; + PyErr_SetString(spoolss_error, + "level not an integer"); + return NULL; } level = PyInt_AsLong(level_obj); @@ -212,14 +213,13 @@ PyObject *spoolss_setprinter(PyObject *self, PyObject *args, PyObject *kw) /* Only level 2, 3 supported by NT */ if (level != 2 && level != 3) { - DEBUG(0, ("** unsupported info level\n")); - goto error; + PyErr_SetString(spoolss_error, + "unsupported info level"); + return NULL; } } else { - DEBUG(0, ("** no level info\n")); - error: - PyErr_SetString(spoolss_error, "invalid info"); + PyErr_SetString(spoolss_error, "no info level present"); return NULL; } @@ -232,8 +232,22 @@ PyObject *spoolss_setprinter(PyObject *self, PyObject *args, PyObject *kw) ctr.printers_2 = &pinfo.printers_2; if (!py_to_PRINTER_INFO_2(&pinfo.printers_2, info, - hnd->mem_ctx)) - goto error; + hnd->mem_ctx)){ + PyErr_SetString(spoolss_error, + "error converting printer to info 2"); + return NULL; + } + + break; + case 3: + ctr.printers_3 = &pinfo.printers_3; + + if (!py_to_PRINTER_INFO_3(&pinfo.printers_3, info, + hnd->mem_ctx)) { + PyErr_SetString(spoolss_error, + "error converting to printer info 3"); + return NULL; + } break; default: |