summaryrefslogtreecommitdiff
path: root/python/cdrom.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-02-27 17:31:39 +0100
committerJulian Andres Klode <jak@debian.org>2010-02-27 17:31:39 +0100
commita169fd15520d61303639c0dfa2aabec3f6446fb6 (patch)
tree7e791c9c63df5bddae36c4734164a24618bc95b0 /python/cdrom.cc
parent523c71a6c9b722804c65efdb79daafc56248488f (diff)
downloadpython-apt-a169fd15520d61303639c0dfa2aabec3f6446fb6.tar.gz
* python:
- Handle deprecated attributes and methods in the tp_gettattro slot, this allows us to easily warn if a deprecated function is used.
Diffstat (limited to 'python/cdrom.cc')
-rw-r--r--python/cdrom.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/python/cdrom.cc b/python/cdrom.cc
index 0b9ae578..9eae49dc 100644
--- a/python/cdrom.cc
+++ b/python/cdrom.cc
@@ -78,6 +78,9 @@ static PyObject *cdrom_ident(PyObject *Self,PyObject *Args)
#ifdef COMPAT_0_7
static PyObject *cdrom_ident_old(PyObject *Self,PyObject *Args)
{
+ PyErr_WarnEx(PyExc_DeprecationWarning, "Method 'Ident' of the "
+ "'apt_pkg.Cdrom' object is deprecated, use 'ident' instead.",
+ 1);
pkgCdrom &Cdrom = GetCpp<pkgCdrom>(Self);
PyObject *pyCdromProgressInst = 0;
@@ -101,8 +104,7 @@ static PyMethodDef cdrom_methods[] = {
{"add",cdrom_add,METH_VARARGS,cdrom_add_doc},
{"ident",cdrom_ident,METH_VARARGS,cdrom_ident_doc},
#ifdef COMPAT_0_7
- {"Add",cdrom_add,METH_VARARGS,"Add(progress) -> Add a cdrom"},
- {"Ident",cdrom_ident_old,METH_VARARGS,"Ident(progress) -> Ident a cdrom"},
+ {"Ident",cdrom_ident_old,METH_VARARGS,"DEPRECATED. DO NOT USE"},
#endif
{}
};
@@ -134,7 +136,7 @@ PyTypeObject PyCdrom_Type = {
0, // tp_hash
0, // tp_call
0, // tp_str
- 0, // tp_getattro
+ _PyAptObject_getattro, // tp_getattro
0, // tp_setattro
0, // tp_as_buffer
Py_TPFLAGS_DEFAULT | // tp_flags