summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog5
-rw-r--r--python/configuration.cc17
2 files changed, 21 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index cb747f14..14ad4bf5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
python-apt (0.7.97) UNRELEASED; urgency=low
+ [ Julian Andres Klode ]
* python/tag.cc:
- Support gzip compression for control files (Closes: #383617),
requires APT (>> 0.7.26~exp10) to work.
@@ -8,6 +9,10 @@ python-apt (0.7.97) UNRELEASED; urgency=low
after them).
* python/apt_pkgmodule.cc:
- Bind pkgAcquire::Item::StatTransientNetworkError (Closes: #589010)
+
+ [ Michael Vogt ]
+ * python/configuration.cc:
+ - add binding for the "dump()" method to configruation objects
-- Julian Andres Klode <jak@debian.org> Fri, 23 Jul 2010 16:14:39 +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 <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