bintree: clean up dict use in old binhost code
authorZac Medico <zmedico@gentoo.org>
Thu, 3 Feb 2011 07:12:24 +0000 (23:12 -0800)
committerZac Medico <zmedico@gentoo.org>
Thu, 3 Feb 2011 07:12:24 +0000 (23:12 -0800)
pym/portage/dbapi/bintree.py

index 4857e7fbf029237d34cd7846f3e28d102a3daf14..6e58608a31fefd525fdfcba71706c3b6d06df7e6 100644 (file)
@@ -912,13 +912,14 @@ class binarytree(object):
                                base_url, chunk_size=chunk_size)
 
                        for mypkg, remote_metadata in list(remotepkgs.items()):
-                               if "CATEGORY" not in remote_metadata:
+                               mycat = remote_metadata.get("CATEGORY")
+                               if mycat is None:
                                        #old-style or corrupt package
                                        writemsg(_("!!! Invalid remote binary package: %s\n") % mypkg,
                                                noiselevel=-1)
                                        del remotepkgs[mypkg]
                                        continue
-                               mycat = remotepkgs[mypkg]["CATEGORY"].strip()
+                               mycat = mycat.strip()
                                fullpkg = mycat+"/"+mypkg[:-5]
 
                                if fullpkg in metadata: