diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-06-20 13:29:35 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-06-20 13:29:35 +0200 |
commit | 74c66c9a3f6aedbbcdbce66a1d72a3c3b74137f8 (patch) | |
tree | 0c597bee5ad5193d3c43a1678c082bd0a43c2077 /source4/param | |
parent | f051a8557f29352b4ec76ab6a8ed4de083f0816f (diff) | |
download | samba-74c66c9a3f6aedbbcdbce66a1d72a3c3b74137f8.tar.gz samba-74c66c9a3f6aedbbcdbce66a1d72a3c3b74137f8.tar.bz2 samba-74c66c9a3f6aedbbcdbce66a1d72a3c3b74137f8.zip |
s4-python: Implement LoadParm.dump().
Diffstat (limited to 'source4/param')
-rw-r--r-- | source4/param/pyparam.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c index 40d25f7dcd..3335dd9a64 100644 --- a/source4/param/pyparam.c +++ b/source4/param/pyparam.c @@ -246,6 +246,27 @@ static PyObject *py_lp_ctx_services(py_talloc_Object *self) return ret; } +static PyObject *py_lp_dump(PyObject *self, PyObject *args) +{ + PyObject *py_stream; + bool show_defaults = false; + FILE *f; + struct loadparm_context *lp_ctx = PyLoadparmContext_AsLoadparmContext(self); + + if (!PyArg_ParseTuple(args, "O|b", &py_stream, &show_defaults)) + return NULL; + + f = PyFile_AsFile(py_stream); + if (f == NULL) { + PyErr_SetString(PyExc_TypeError, "Not a file stream"); + return NULL; + } + + lp_dump(lp_ctx, f, show_defaults, lp_numservices(lp_ctx)); + + Py_RETURN_NONE; +} + static PyMethodDef py_lp_ctx_methods[] = { { "load", (PyCFunction)py_lp_ctx_load, METH_VARARGS, "S.load(filename) -> None\n" @@ -269,6 +290,8 @@ static PyMethodDef py_lp_ctx_methods[] = { "S.private_path(name) -> path\n" }, { "services", (PyCFunction)py_lp_ctx_services, METH_NOARGS, "S.services() -> list" }, + { "dump", (PyCFunction)py_lp_dump, METH_VARARGS, + "S.dump(stream, show_defaults=False)" }, { NULL } }; |