[csw-devel] SF.net SVN: gar:[15984] csw/mgar/gar/v2/lib
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Tue Oct 25 10:19:16 CEST 2011
Revision: 15984
http://gar.svn.sourceforge.net/gar/?rev=15984&view=rev
Author: wahwah
Date: 2011-10-25 08:19:15 +0000 (Tue, 25 Oct 2011)
Log Message:
-----------
pkgdb-web: full pkg stats to a specialized place
The generic rest representation function is called from other places too, it's
best not to make it too heavy.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/models.py
csw/mgar/gar/v2/lib/web/pkgdb_web.py
Modified: csw/mgar/gar/v2/lib/python/models.py
===================================================================
--- csw/mgar/gar/v2/lib/python/models.py 2011-10-25 08:05:26 UTC (rev 15983)
+++ csw/mgar/gar/v2/lib/python/models.py 2011-10-25 08:19:15 UTC (rev 15984)
@@ -248,12 +248,6 @@
return vendor_url
def GetRestRepr(self):
- """The returned data structure needs a bit of fiddling.
-
- The frozenset and datatime.datetime objects are returned, and require
- a specialized JSON serializer. See lib/web/pkgdb_web.py for the
- implementation.
- """
mimetype = "application/x-vnd.opencsw.pkg;type=srv4-detail"
data = {
'arch': self.arch.name,
@@ -276,7 +270,6 @@
# 'in_catalogs': unicode([unicode(x) for x in self.in_catalogs]),
'vendor_url': self.GetVendorUrl(),
'repository_url': self.GetSvnUrl(),
- 'pkg_stats': self.GetStatsStruct(),
}
return mimetype, data
Modified: csw/mgar/gar/v2/lib/web/pkgdb_web.py
===================================================================
--- csw/mgar/gar/v2/lib/web/pkgdb_web.py 2011-10-25 08:05:26 UTC (rev 15983)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py 2011-10-25 08:19:15 UTC (rev 15984)
@@ -285,6 +285,7 @@
try:
pkg = models.Srv4FileStats.selectBy(md5_sum=md5_sum).getOne()
mimetype, data_structure = pkg.GetRestRepr()
+ data_structure["pkg_stats"] = pkg.GetStatsStruct()
web.header('Content-type', mimetype)
web.header('Access-Control-Allow-Origin', '*')
return json.dumps(data_structure, cls=PkgStatsEncoder)
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