summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-07-27 11:17:52 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2009-07-27 11:17:52 +0200
commitd724db2ef374c97e05f19d6e0bedb6a933426147 (patch)
treec92f7932dcfb6085cde357d31b0e5c12330158f6
parentf8a5f4a2fef199f112135c2bb24515b569634085 (diff)
downloadpython-apt-d724db2ef374c97e05f19d6e0bedb6a933426147.tar.gz
* python/tag.cc:
- merge patch from John Wright that adds FindRaw method (closes: #538723)
-rw-r--r--debian/changelog8
-rw-r--r--python/tag.cc24
2 files changed, 31 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 5a5b7529..e0bc5a6f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,15 @@
python-apt (0.7.11.1) UNRELEASED; urgency=low
+ [ Stephan Peijnik ]
* apt/progress/__init__.py:
- Exception handling fixes in InstallProgress class.
+
+ [ Michael Vogt ]
+ * python/tag.cc:
+ - merge patch from John Wright that adds FindRaw method
+ (closes: #538723)
- -- Stephan Peijnik <debian@sp.or.at> Sat, 25 Jul 2009 10:37:11 +0200
+ -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 27 Jul 2009 11:17:27 +0200
python-apt (0.7.11.0) unstable; urgency=low
diff --git a/python/tag.cc b/python/tag.cc
index 217be290..6fe97ed5 100644
--- a/python/tag.cc
+++ b/python/tag.cc
@@ -92,6 +92,29 @@ static PyObject *TagSecFind(PyObject *Self,PyObject *Args)
return PyString_FromStringAndSize(Start,Stop-Start);
}
+static char *doc_FindRaw = "FindRaw(Name) -> String/None";
+static PyObject *TagSecFindRaw(PyObject *Self,PyObject *Args)
+{
+ char *Name = 0;
+ char *Default = 0;
+ if (PyArg_ParseTuple(Args,"s|z",&Name,&Default) == 0)
+ return 0;
+
+ unsigned Pos;
+ if (GetCpp<pkgTagSection>(Self).Find(Name,Pos) == false)
+ {
+ if (Default == 0)
+ Py_RETURN_NONE;
+ return PyString_FromString(Default);
+ }
+
+ const char *Start;
+ const char *Stop;
+ GetCpp<pkgTagSection>(Self).Get(Start,Stop,Pos);
+
+ return PyString_FromStringAndSize(Start,Stop-Start);
+}
+
static char *doc_FindFlag = "FindFlag(Name) -> integer/none";
static PyObject *TagSecFindFlag(PyObject *Self,PyObject *Args)
{
@@ -355,6 +378,7 @@ static PyMethodDef TagSecMethods[] =
{
// Query
{"Find",TagSecFind,METH_VARARGS,doc_Find},
+ {"FindRaw",TagSecFindRaw,METH_VARARGS,doc_FindRaw},
{"FindFlag",TagSecFindFlag,METH_VARARGS,doc_FindFlag},
{"Bytes",TagSecBytes,METH_VARARGS,doc_Bytes},