summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <Panu Matilainen pmatilai@redhat.com>2011-08-25 12:02:48 +0300
committerPanu Matilainen <Panu Matilainen pmatilai@redhat.com>2011-08-25 12:21:16 +0300
commit93639ec8e679e32890ab6f80b5be7913a651634b (patch)
tree69a3eab8b16943d50ec0ff34d134e777c04b26f2
parentb37b4fbd48cd78a7749c1b098425db19cf1b8ded (diff)
downloadlibrpm-tizen-93639ec8e679e32890ab6f80b5be7913a651634b.tar.gz
librpm-tizen-93639ec8e679e32890ab6f80b5be7913a651634b.tar.bz2
librpm-tizen-93639ec8e679e32890ab6f80b5be7913a651634b.zip
Export rpmtsEmpty() to python as ts.clear()
- Why the heck hasn't this been exported before, duh? - Method name clear() chosen as this appears to be emerging as a standard of sorts for this kind of operation: dictionaries and sets have it and list will get it in some python 3.x version. Additionally foo.empty() could easily be mistaken for "test whether container foo is empty or not" (especially those with c++ background...)
-rw-r--r--python/rpmts-py.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index 0a55417c7..854d3a1ee 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -279,6 +279,14 @@ rpmts_Clean(rpmtsObject * s)
}
static PyObject *
+rpmts_Clear(rpmtsObject * s)
+{
+ rpmtsEmpty(s->ts);
+
+ Py_RETURN_NONE;
+}
+
+static PyObject *
rpmts_OpenDB(rpmtsObject * s)
{
int dbmode;
@@ -677,6 +685,9 @@ static struct PyMethodDef rpmts_methods[] = {
Note: The callback may not be None.\n" },
{"clean", (PyCFunction) rpmts_Clean, METH_NOARGS,
NULL },
+ {"clear", (PyCFunction) rpmts_Clear, METH_NOARGS,
+"ts.clear() -> None\n\
+Remove all elements from the transaction set\n" },
{"openDB", (PyCFunction) rpmts_OpenDB, METH_NOARGS,
"ts.openDB() -> None\n\
- Open the default transaction rpmdb.\n\