Py3k compatibility patch #2 by Ali Polatel <hawking@g.o>.
authorZac Medico <zmedico@gentoo.org>
Tue, 1 Jul 2008 12:42:15 +0000 (12:42 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 1 Jul 2008 12:42:15 +0000 (12:42 -0000)
Replace dict.has_key() calls with "in" and "not in" operators.

svn path=/main/trunk/; revision=10871

pym/portage/cache/metadata_overlay.py
pym/portage/cache/sql_template.py

index 13d12787e17e27d2733ae3a0457a050fe81d5b28..e25759c4a33a4ffc224400681ef65908d239162c 100644 (file)
@@ -61,7 +61,7 @@ class database(template.database):
 
        def _delitem(self, cpv):
                value = self[cpv] # validates whiteout and/or raises a KeyError when necessary
-               if self.db_ro.has_key(cpv):
+               if cpv in self.db_ro:
                        self.db_rw[cpv] = self._create_whiteout(value)
                else:
                        del self.db_rw[cpv]
index f32a7284447bb6855f14f02d146b207db5f42d28..196039c74950cd24ca7675bff20b05aa6f7da8c6 100644 (file)
@@ -150,7 +150,7 @@ class SQLDatabase(template.database):
                        # so we store only what's handed to us and is a known key
                        db_values = []
                        for key in self._known_keys:
-                               if values.has_key(key) and values[key] != '':
+                               if key in values and values[key]:
                                        db_values.append({"key":key, "value":values[key]})
 
                        if len(db_values) > 0: