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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Jan 17 15:37:32 CET 2011


Revision: 12981
          http://gar.svn.sourceforge.net/gar/?rev=12981&view=rev
Author:   wahwah
Date:     2011-01-17 14:37:32 +0000 (Mon, 17 Jan 2011)

Log Message:
-----------
pkgdb: Add a method to get srv4 data structure

There was more than one place retrieving / unpickling the data structure from
a Srv4FileStats object.  Let's add a common method instead.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/checkpkg_lib.py
    csw/mgar/gar/v2/lib/python/models.py
    csw/mgar/gar/v2/lib/python/package_stats.py
    csw/mgar/gar/v2/lib/python/pkgdb.py

Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2011-01-17 13:32:27 UTC (rev 12980)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2011-01-17 14:37:32 UTC (rev 12981)
@@ -202,7 +202,7 @@
       # left is lists and dictionaries.
       i = counter.next()
       if stats_obj.data_obj:
-        raw_pkg_data = cPickle.loads(stats_obj.data_obj.pickle)
+        raw_pkg_data = stats_obj.GetStatsStruct()
       else:
         raise CatalogDatabaseError(
             "%s (%s) is missing the data object."

Modified: csw/mgar/gar/v2/lib/python/models.py
===================================================================
--- csw/mgar/gar/v2/lib/python/models.py	2011-01-17 13:32:27 UTC (rev 12980)
+++ csw/mgar/gar/v2/lib/python/models.py	2011-01-17 14:37:32 UTC (rev 12981)
@@ -200,7 +200,10 @@
         u"Package: %s-%s, %s"
         % (self.catalogname, self.version_string, self.arch.name))
 
+  def GetStatsStruct(self):
+    return cPickle.loads(str(self.data_obj.pickle))
 
+
 class CheckpkgErrorTagMixin(object):
 
   def ToGarSyntax(self):

Modified: csw/mgar/gar/v2/lib/python/package_stats.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_stats.py	2011-01-17 13:32:27 UTC (rev 12980)
+++ csw/mgar/gar/v2/lib/python/package_stats.py	2011-01-17 14:37:32 UTC (rev 12981)
@@ -430,7 +430,7 @@
       if not srv4.data_obj:
         raise DatabaseError("Could not find the data object for %s (%s)"
                             % (srv4.basename, md5_sum))
-      self.all_stats = cPickle.loads(str(srv4.data_obj.pickle))
+      self.all_stats = srv4.GetStatsStruct()
     return self.all_stats
 
 

Modified: csw/mgar/gar/v2/lib/python/pkgdb.py
===================================================================
--- csw/mgar/gar/v2/lib/python/pkgdb.py	2011-01-17 13:32:27 UTC (rev 12980)
+++ csw/mgar/gar/v2/lib/python/pkgdb.py	2011-01-17 14:37:32 UTC (rev 12981)
@@ -110,7 +110,7 @@
     # Add error tags
     for identifier in self.identifiers:
       srv4 = GetPkg(identifier)
-      data = cPickle.loads(str(srv4.data_obj.pickle))
+      data = srv4.GetStatsStruct()
       if "OPENCSW_REPOSITORY" in data["pkginfo"]:
         build_src = data["pkginfo"]["OPENCSW_REPOSITORY"]
         build_src_url_svn = re.sub(r'([^@]*).*', r'\1/Makefile', build_src)


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