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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Jan 24 01:11:31 CET 2011


Revision: 13080
          http://gar.svn.sourceforge.net/gar/?rev=13080&view=rev
Author:   wahwah
Date:     2011-01-24 00:11:31 +0000 (Mon, 24 Jan 2011)

Log Message:
-----------
csw-upload-pkg: an exception on missing metadata

When the metadata is not available when it should be, throw an exception.

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

Modified: csw/mgar/gar/v2/lib/python/csw_upload_pkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/csw_upload_pkg.py	2011-01-24 00:10:40 UTC (rev 13079)
+++ csw/mgar/gar/v2/lib/python/csw_upload_pkg.py	2011-01-24 00:11:31 UTC (rev 13080)
@@ -34,6 +34,10 @@
   """A problem with the package."""
 
 
+class DataError(Error):
+  """Unexpected data found."""
+
+
 class Srv4Uploader(object):
 
   def __init__(self, filenames, debug=False):
@@ -127,6 +131,8 @@
       self._PostFile(filename)
     file_in_allpkgs, file_metadata = self._GetSrv4FileMetadata(md5_sum)
     logging.debug("file_metadata %s", repr(file_metadata))
+    if not file_metadata:
+      raise DataError("file_metadata is empty: %s" % repr(file_metadata))
     osrel = file_metadata['osrel']
     arch = file_metadata['arch']
     self._IterateOverCatalogs(
@@ -210,6 +216,8 @@
     metadata = None
     if successful:
       metadata = json.loads(d.getvalue())
+    else:
+      logging.info("Data for %s not found" % repr(md5_sum))
     return successful, metadata
 
   def _PostFile(self, filename):


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