diff options
| author | Julian Andres Klode <jak@debian.org> | 2011-04-05 14:46:16 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2011-04-05 14:46:16 +0200 |
| commit | 5cc6fcb55f1fa50094a56644178c5e728deb83a4 (patch) | |
| tree | eeeac19476dba9ef34122a91d5d528e700c98fb6 /python/cache.cc | |
| parent | 4548cac388f26cec60f1cef028421db910385565 (diff) | |
| download | python-apt-5cc6fcb55f1fa50094a56644178c5e728deb83a4.tar.gz | |
Change apt_pkg.Cache() so that passing None for 'progress' results in
no progress output
Diffstat (limited to 'python/cache.cc')
| -rw-r--r-- | python/cache.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/python/cache.cc b/python/cache.cc index b5ebcce4..6f1585e5 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -299,7 +299,11 @@ static PyObject *PkgCacheNew(PyTypeObject *type,PyObject *Args,PyObject *kwds) pkgCacheFile *Cache = new pkgCacheFile(); - if(pyCallbackInst != 0) { + if (pyCallbackInst == Py_None) { + OpProgress Prog; + if (Cache->Open(Prog,false) == false) + return HandleErrors(); + } else if(pyCallbackInst != 0) { // sanity check for the progress object, see #497049 if (PyObject_HasAttrString(pyCallbackInst, "done") != true) { PyErr_SetString(PyExc_ValueError, @@ -349,7 +353,8 @@ static char *doc_PkgCache = "Cache([progress]) -> Cache() object.\n\n" "apt.progress.base.OpProgress() object (or similar) which reports\n" "progress information while the cache is being opened. If this\n" "parameter is not supplied, the progress will be reported in simple,\n" - "human-readable text to standard output.\n\n" + "human-readable text to standard output. If it is None, no output\n" + "will be made.\n\n" "The cache can be used like a mapping from package names to Package\n" "objects (although only getting items is supported)."; static PySequenceMethods CacheSeq = {0,0,0,0,0,0,0,CacheContains,0,0}; |
