seth vidal wrote:
> Weird. I was able to replicate the error you sent, then I changed the
> code and the error wasn't there. I still can't replicate it.

I've seen this as well. Attached is my fix; it trys and excepts on
IndexError, rather than using has_key. I'm running python 2.5, could
this be due to some differences in sqlite versions?

-James
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index d805744..c2adae0 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -61,17 +61,20 @@ class YumAvailablePackageSqlite(YumAvailablePackage, PackageObject, RpmBase):
         """read the db obj. If asked for a specific item, return it.
            otherwise populate out into the object what exists"""
         if item:
-            if db_obj.has_key(item):
+            try:
                 return db_obj[item]
-            else:
+            except IndexError:
                 return None
 
         for item in ['name', 'arch', 'epoch', 'version', 'release', 'pkgId']:
-            if db_obj.has_key(item):
+            try:
                 setattr(self, item, db_obj[item])
-
-        if db_obj.has_key('checksum_value'):
+            except IndexError:
+                pass
+        try:
             self._checksums.append((db_obj['checksum_type'], db_obj['checksum_value'], True))
+        except IndexError:
+            pass
 
     def __getattr__(self, varname):
         db2simplemap = { 'packagesize' : 'size_package',

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to