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:16:39 +0000 (23:16 -0800)
pym/portage/dbapi/bintree.py

index 522967a72032fac20e41a863639182d80d02febb..33482a1d359410632d01830c0f2d00890bdeb627 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: