diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-07-27 15:00:12 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-07-27 15:00:12 +0200 |
| commit | af398fcce8671bc864e4300c1b0bbeb07ab95aaf (patch) | |
| tree | e89efbe87083941ab7a220c3a9a93f0e9f6df05c /python/indexfile.cc | |
| parent | 0b081c5451d6394618290cd9a5767d767d98b819 (diff) | |
| parent | 8d79b99c1a3338e31e8def858cee3209824ae8bf (diff) | |
| download | python-apt-af398fcce8671bc864e4300c1b0bbeb07ab95aaf.tar.gz | |
* merged with mainline
Diffstat (limited to 'python/indexfile.cc')
| -rw-r--r-- | python/indexfile.cc | 20 |
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) |
