summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-07-29 09:29:18 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-07-29 09:29:18 +0200
commitf4cd218da7c85dcbaa46bc5c857c9af72ad0bf1b (patch)
tree495026735e2ce93c047e17e1f51d37c98f2120a8 /python
parentd642c9ea22f5705acfcba79493f48293626771c3 (diff)
parent9cf2545567bef5e7dbd8787b0f8db2c60f3ca5eb (diff)
downloadpython-apt-f4cd218da7c85dcbaa46bc5c857c9af72ad0bf1b.tar.gz
merged dump() method from lp:~mvo/python-apt/mvo
Diffstat (limited to 'python')
-rw-r--r--python/configuration.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/python/configuration.cc b/python/configuration.cc
index 7c9ed7bc..848b664a 100644
--- a/python/configuration.cc
+++ b/python/configuration.cc
@@ -19,7 +19,7 @@
#include <apt-pkg/configuration.h>
#include <apt-pkg/cmndline.h>
-
+#include <sstream>
#include <Python.h>
/*}}}*/
@@ -254,6 +254,20 @@ static PyObject *CnfMyTag(PyObject *Self,PyObject *Args)
return CppPyString(Top->Parent->Tag);
}
+static char *doc_Dump =
+ "dump() -> str\n\n"
+ "Return a string dump this Configuration object.";
+static PyObject *CnfDump(PyObject *Self,PyObject *Args)
+{
+ if (PyArg_ParseTuple(Args,"") == 0)
+ return 0;
+
+ stringstream ss;
+ GetSelf(Self).Dump(ss);
+ return CppPyString(ss.str());
+}
+
+
// Look like a mapping
static char *doc_Keys =
"keys([root: str]) -> list\n\n"
@@ -516,6 +530,7 @@ static PyMethodDef CnfMethods[] =
{"value_list",CnfValueList,METH_VARARGS,doc_ValueList},
{"my_tag",CnfMyTag,METH_VARARGS,doc_MyTag},
{"clear",CnfClear,METH_VARARGS,doc_Clear},
+ {"dump",CnfDump,METH_VARARGS,doc_Dump},
// Python Special
{"keys",CnfKeys,METH_VARARGS,doc_Keys},
#if PY_MAJOR_VERSION < 3