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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Jan 23 12:44:39 CET 2011


Revision: 13069
          http://gar.svn.sourceforge.net/gar/?rev=13069&view=rev
Author:   wahwah
Date:     2011-01-23 11:44:39 +0000 (Sun, 23 Jan 2011)

Log Message:
-----------
csw_upload_pkgs: Screen output adjustments

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-23 11:44:11 UTC (rev 13068)
+++ csw/mgar/gar/v2/lib/python/csw_upload_pkg.py	2011-01-23 11:44:39 UTC (rev 13069)
@@ -102,12 +102,18 @@
         http_code,
         c.getinfo(pycurl.EFFECTIVE_URL))
     c.close()
-    if self.debug:
-      logging.debug("*** Headers")
-      logging.debug(h.getvalue())
-      logging.debug("*** Data")
-      logging.debug(d.getvalue())
-    logging.info("Response: %s", d.getvalue())
+    # if self.debug:
+    #   logging.debug("*** Headers")
+    #   logging.debug(h.getvalue())
+    #   logging.debug("*** Data")
+    if http_code >= 400 and http_code <= 499:
+      if not self.debug:
+        # In debug mode, all headers are printed to screen, and we aren't
+        # interested in the response body.
+        logging.fatal("Response: %s %s", http_code, d.getvalue())
+      raise RestCommunicationError("%s - HTTP code: %s" % (url, http_code))
+    else:
+      logging.info("Response: %s %s", http_code, d.getvalue())
     return http_code
 
   def _GetSrv4FileMetadata(self, md5_sum):
@@ -170,7 +176,7 @@
       logging.debug(d.getvalue())
     logging.debug("File POST http code: %s", http_code)
     if http_code >= 400 and http_code <= 499:
-      raise RestCommunicationError("HTTP code: %s" % http_code)
+      raise RestCommunicationError("%s - HTTP code: %s" % (url, http_code))
 
 
 if __name__ == '__main__':


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