diff options
author | Tim Potter <tpot@samba.org> | 2002-03-26 06:25:47 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-03-26 06:25:47 +0000 |
commit | 7cf6b169a3d93672d9fdd801ddff9b68786d512d (patch) | |
tree | facfe891c6c930f17e4651f0181e518ab1627255 /source3/python/py_spoolss.c | |
parent | b39e0d6b436fb7ea2395587e55ba91f8cb11da75 (diff) | |
download | samba-7cf6b169a3d93672d9fdd801ddff9b68786d512d.tar.gz samba-7cf6b169a3d93672d9fdd801ddff9b68786d512d.tar.bz2 samba-7cf6b169a3d93672d9fdd801ddff9b68786d512d.zip |
Moved form related functions as methods in the policy handle object.
(This used to be commit 7c4bcc48aa9ff3227673522f32170bcefb0b7208)
Diffstat (limited to 'source3/python/py_spoolss.c')
-rw-r--r-- | source3/python/py_spoolss.c | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/source3/python/py_spoolss.c b/source3/python/py_spoolss.c index 37074baca1..3edc622901 100644 --- a/source3/python/py_spoolss.c +++ b/source3/python/py_spoolss.c @@ -22,6 +22,7 @@ #include "Python.h" #include "python/py_common.h" #include "python/py_spoolss.h" +#include "python/py_spoolss_forms.h" /* Exceptions this module can raise */ @@ -32,6 +33,35 @@ static void py_policy_hnd_dealloc(PyObject* self) PyObject_Del(self); } + + +static PyMethodDef spoolss_hnd_methods[] = { + + /* Forms */ + + { "enumforms", spoolss_enumforms, METH_VARARGS | METH_KEYWORDS, + "Enumerate forms" }, + + { "setform", spoolss_setform, METH_VARARGS | METH_KEYWORDS, + "Modify properties of a form" }, + + { "addform", spoolss_addform, METH_VARARGS | METH_KEYWORDS, + "Insert a form" }, + + { "getform", spoolss_getform, METH_VARARGS | METH_KEYWORDS, + "Fetch form properties" }, + + { "deleteform", spoolss_deleteform, METH_VARARGS | METH_KEYWORDS, + "Delete a form" }, + + { NULL } + +}; +static PyObject *py_policy_hnd_getattr(PyObject *self, char *attrname) +{ + return Py_FindMethod(spoolss_hnd_methods, self, attrname); +} + static PyObject *new_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx, POLICY_HND *pol) { @@ -54,7 +84,7 @@ PyTypeObject spoolss_policy_hnd_type = { 0, py_policy_hnd_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ - 0, /*tp_getattr*/ + py_policy_hnd_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ @@ -1023,26 +1053,6 @@ static PyMethodDef spoolss_methods[] = { { "enumprinters", spoolss_enumprinters, METH_VARARGS | METH_KEYWORDS, "Enumerate printers" }, - /* Forms */ - - { "enumforms", spoolss_enumforms, METH_VARARGS | METH_KEYWORDS, - "Enumerate forms" }, - - { "setform", spoolss_setform, METH_VARARGS | METH_KEYWORDS, - "Modify properties of a form" }, - - { "addform", spoolss_addform, METH_VARARGS | METH_KEYWORDS, - "Insert a form" }, - - { "getform", spoolss_getform, METH_VARARGS | METH_KEYWORDS, - "Fetch form properties" }, - - { "deleteform", spoolss_deleteform, METH_VARARGS | METH_KEYWORDS, - "Delete a form" }, - - { "enumforms", spoolss_enumforms, METH_VARARGS | METH_KEYWORDS, - "Delete a form" }, - { NULL } }; @@ -1081,6 +1091,7 @@ static void const_init(PyObject *dict) for (tmp = spoolss_const_vals; tmp->name; tmp++) { obj = PyInt_FromLong(tmp->value); PyDict_SetItemString(dict, tmp->name, obj); + Py_DECREF(obj); } } |