SF.net SVN: gar:[23125] csw/mgar/gar/v2/lib/python

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Tue Mar 4 01:19:26 CET 2014


Revision: 23125
          http://sourceforge.net/p/gar/code/23125
Author:   wahwah
Date:     2014-03-04 00:19:23 +0000 (Tue, 04 Mar 2014)
Log Message:
-----------
csw-upload-pkg: register pkg only when necessary

Calling the register function is destructive and causes a package to be
removed from all catalogs. The code probably needs to be written more
defensively against this, but at the very least we can stop calling it
unconditionally when uploading a package.

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

Modified: csw/mgar/gar/v2/lib/python/csw_upload_pkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/csw_upload_pkg.py	2014-03-03 23:36:01 UTC (rev 23124)
+++ csw/mgar/gar/v2/lib/python/csw_upload_pkg.py	2014-03-04 00:19:23 UTC (rev 23125)
@@ -136,7 +136,8 @@
     for filename in self.filenames:
       self._ImportMetadata(filename)
       md5_sum = self._GetFileMd5sum(filename)
-      self._rest_client.RegisterLevelTwo(md5_sum)
+      if not self._rest_client.IsRegisteredLevelTwo(md5_sum):
+        self._rest_client.RegisterLevelTwo(md5_sum)
       file_in_allpkgs, file_metadata = self._GetSrv4FileMetadata(md5_sum)
       if file_in_allpkgs:
         logging.debug("File %s already uploaded.", filename)

Modified: csw/mgar/gar/v2/lib/python/relational_util.py
===================================================================
--- csw/mgar/gar/v2/lib/python/relational_util.py	2014-03-03 23:36:01 UTC (rev 23124)
+++ csw/mgar/gar/v2/lib/python/relational_util.py	2014-03-04 00:19:23 UTC (rev 23125)
@@ -45,6 +45,9 @@
 
   This function is intended to be called by the restful interface, not by
   applications directly. Therefore, we're not using the RESTful interface here.
+
+  Note: This operation is destructive! Calling it results in the package being
+  removed from all the catalogs.
   """
   # We assume stats already exist. If not, we're letting sqlobject throw an
   # exception.

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