[csw-devel] SF.net SVN: gar:[18222] csw/mgar/gar/v2/lib/python/integrate_catalogs.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Tue Jun 5 10:16:08 CEST 2012


Revision: 18222
          http://gar.svn.sourceforge.net/gar/?rev=18222&view=rev
Author:   wahwah
Date:     2012-06-05 08:16:07 +0000 (Tue, 05 Jun 2012)
Log Message:
-----------
integrate-catalogs: A fix for creating new catalog

If the dict element exists, but isn't iterable (e.g. None isn't).

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/integrate_catalogs.py

Modified: csw/mgar/gar/v2/lib/python/integrate_catalogs.py
===================================================================
--- csw/mgar/gar/v2/lib/python/integrate_catalogs.py	2012-06-05 08:15:42 UTC (rev 18221)
+++ csw/mgar/gar/v2/lib/python/integrate_catalogs.py	2012-06-05 08:16:07 UTC (rev 18222)
@@ -249,21 +249,22 @@
     bundles_missing = set()
     cp = rest.CachedPkgstats("pkgstats")
     for key in catalogs:
-      for pkg in catalogs[key]:
-        # logging.debug("%r", pkg)
-        md5 = pkg["md5_sum"]
-        if md5 not in bundles_by_md5 and md5 not in bundles_missing:
-          stats = cp.GetPkgstats(md5)
-          bundle_key = "OPENCSW_BUNDLE"
-          # pprint.pprint(stats)
-          if stats:
-            if bundle_key in stats["pkginfo"]:
-              bundles_by_md5[md5] = stats["pkginfo"][bundle_key]
-            else:
-              logging.debug(
-                  "%r (%r) does not have the bundle set",
-                  stats["basic_stats"]["pkg_basename"], md5)
-              bundles_missing.add(md5)
+      if catalogs[key]: # could be None
+        for pkg in catalogs[key]:
+          # logging.debug("%r", pkg)
+          md5 = pkg["md5_sum"]
+          if md5 not in bundles_by_md5 and md5 not in bundles_missing:
+            stats = cp.GetPkgstats(md5)
+            bundle_key = "OPENCSW_BUNDLE"
+            # pprint.pprint(stats)
+            if stats:
+              if bundle_key in stats["pkginfo"]:
+                bundles_by_md5[md5] = stats["pkginfo"][bundle_key]
+              else:
+                logging.debug(
+                    "%r (%r) does not have the bundle set",
+                    stats["basic_stats"]["pkg_basename"], md5)
+                bundles_missing.add(md5)
   # Here's a good place to calculate the mapping between catalognames and
   # bundle names.
   change_types = "new_pkgs", "removed_pkgs", "updated_pkgs"

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list