From 9cf2545567bef5e7dbd8787b0f8db2c60f3ca5eb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 29 Jul 2010 09:26:34 +0200 Subject: * python/configuration.cc: - add binding for the "dump()" method to configruation objects --- debian/changelog | 2 ++ python/configuration.cc | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 466913a5..0e12c5c3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ python-apt (0.7.96.1) UNRELEASED; urgency=low * tests/test_debfile.py: - properly setup fixture data to make debfile test pass (closes: #588796) + * python/configuration.cc: + - add binding for the "dump()" method to configruation objects -- Michael Vogt Mon, 12 Jul 2010 14:14:51 +0200 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 #include - +#include #include /*}}}*/ @@ -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 -- cgit v1.2.3