[yum-commits] Branch 'yum-3_2_X' - yum/mdparser.py

Ville Skyttä scop at osuosl.org
Fri Oct 16 19:55:58 UTC 2009


 yum/mdparser.py |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 8f88275fee34501c02ba0f05380340a6e44149c1
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Oct 2 00:25:43 2009 +0300

    Deprecate has_key() in favour of "in" for metadata entries.
    
    As a side effect, entries are now iterable.

diff --git a/yum/mdparser.py b/yum/mdparser.py
index c74608d..26c128b 100644
--- a/yum/mdparser.py
+++ b/yum/mdparser.py
@@ -22,6 +22,9 @@ except ImportError:
 iterparse = cElementTree.iterparse
 
 from cStringIO import StringIO
+import warnings
+
+import Errors
 
 #TODO: document everything here
 
@@ -79,7 +82,12 @@ class BaseEntry:
         return self._p.values()
 
     def has_key(self, k):
-        return self._p.has_key(k)
+        warnings.warn('has_key() will go away in a future version of Yum.\n'
+                      Errors.YumFutureDeprecationWarning, stacklevel=2)
+        return k in self._p
+
+    def __iter__(self):
+        return iter(self._p)
 
     def __str__(self):
         out = StringIO()


More information about the Yum-commits mailing list