diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-07-29 09:31:40 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-07-29 09:31:40 +0200 |
| commit | 4021c9b34138674d59d643b48435fa24fb5dbfe9 (patch) | |
| tree | 9565aca72b74e15e0b54b3696c3c9e0323b3dcf4 | |
| parent | cee5d33d44130ce8ceb7b563f7b97f2bf9a3ca5c (diff) | |
| parent | f4cd218da7c85dcbaa46bc5c857c9af72ad0bf1b (diff) | |
| download | python-apt-4021c9b34138674d59d643b48435fa24fb5dbfe9.tar.gz | |
* python/configuration.cc:
- add binding for the "dump()" method to configruation objects
| -rw-r--r-- | debian/changelog | 8 | ||||
| -rw-r--r-- | python/configuration.cc | 17 |
2 files changed, 24 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog index d95f87e5..3083d377 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +python-apt (0.7.96.1ubuntu2) maverick; urgency=low + + [ Michael Vogt ] + * python/configuration.cc: + - add binding for the "dump()" method to configruation objects + + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 29 Jul 2010 09:31:10 +0200 + python-apt (0.7.96.1ubuntu1) maverick; urgency=low [ Julian Andres Klode ] 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 |
