summaryrefslogtreecommitdiff
path: root/python/indexfile.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-03-22 15:07:21 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2006-03-22 15:07:21 +0100
commiteef094d6218739bc0147910bfdd478ac10f18ec1 (patch)
treefb2da4bb8e544e4dde919d241b299b38c6b4bf10 /python/indexfile.cc
parente02913b6f336d4bf5bc2c17032c91ade974de04f (diff)
downloadpython-apt-eef094d6218739bc0147910bfdd478ac10f18ec1.tar.gz
* added indexFile.ArchiveURI(string)
Diffstat (limited to 'python/indexfile.cc')
-rw-r--r--python/indexfile.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/python/indexfile.cc b/python/indexfile.cc
index 4e106e25..ef6ffc8a 100644
--- a/python/indexfile.cc
+++ b/python/indexfile.cc
@@ -15,6 +15,22 @@
#include <Python.h>
+static PyObject *PackageIndexFileArchiveURI(PyObject *Self,PyObject *Args)
+{
+ pkgIndexFile *File = GetCpp<pkgIndexFile*>(Self);
+ char *path;
+
+ if (PyArg_ParseTuple(Args, "s",&path) == 0)
+ return 0;
+
+ return HandleErrors(Safe_FromString(File->ArchiveURI(path).c_str()));
+}
+
+static PyMethodDef PackageIndexFileMethods[] =
+{
+ {"ArchiveURI",PackageIndexFileArchiveURI,METH_VARARGS,"Returns the ArchiveURI"},
+ {}
+};
static PyObject *PackageIndexFileAttr(PyObject *Self,char *Name)
@@ -33,8 +49,7 @@ static PyObject *PackageIndexFileAttr(PyObject *Self,char *Name)
else if (strcmp("IsTrusted",Name) == 0)
return Py_BuildValue("i",(File->IsTrusted()));
- PyErr_SetString(PyExc_AttributeError,Name);
- return 0;
+ return Py_FindMethod(PackageIndexFileMethods,Self,Name);
}
static PyObject *PackageIndexFileRepr(PyObject *Self)
@@ -51,6 +66,7 @@ static PyObject *PackageIndexFileRepr(PyObject *Self)
File->IsTrusted(), File->ArchiveURI("").c_str());
return PyString_FromString(S);
}
+
PyTypeObject PackageIndexFileType =
{
PyObject_HEAD_INIT(&PyType_Type)