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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Feb 5 01:59:16 CET 2012


Revision: 16996
          http://gar.svn.sourceforge.net/gar/?rev=16996&view=rev
Author:   wahwah
Date:     2012-02-05 00:59:16 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
pkgdb-web: Quick catalogs

Allow to pass ?quick=true to get a catalog with less data, and get it quicker.
Testing shows times ~20s -- ~60s.

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	2012-02-05 00:58:42 UTC (rev 16995)
+++ csw/mgar/gar/v2/lib/python/models.py	2012-02-05 00:59:16 UTC (rev 16996)
@@ -293,28 +293,29 @@
     #  - GetVendorUrl unpickles the object (very slow)
     #  - GetSvnUrl unpickles the object (very slow)
     data = {
-        'arch': self.arch.name,
         'basename': self.basename,
         # For compatibility with the catalog parser from catalog.py
         'file_basename': self.basename,
         'catalogname': self.catalogname,
-        'filename_arch': self.filename_arch.name,
-        'maintainer_email': self.maintainer.email,
-        'maintainer_full_name': self.maintainer.full_name,
-        'maintainer_id': self.maintainer.id,
         'md5_sum': self.md5_sum,
         'mtime': unicode(self.mtime),
-        'osrel': self.os_rel.short_name,
-        'pkgname': self.pkginst.pkgname,
         'rev': self.rev,
         'size': self.size,
         'version_string': self.version_string,
         # For compatibility with the catalog parser from catalog.py
         'version': self.version_string,
-        # 'in_catalogs': unicode([unicode(x) for x in self.in_catalogs]),
-        'vendor_url': self.GetVendorUrl(),
-        'repository_url': self.GetSvnUrl(),
     }
+    if not quick:
+       data['arch'] = self.arch.name
+       data['filename_arch'] = self.filename_arch.name
+       data['maintainer_email'] = self.maintainer.email
+       data['maintainer_full_name'] = self.maintainer.full_name
+       data['maintainer_id'] = self.maintainer.id
+       data['osrel'] = self.os_rel.short_name
+       data['pkgname'] = self.pkginst.pkgname
+       data['vendor_url'] = self.GetVendorUrl()
+       data['repository_url'] = self.GetSvnUrl()
+       # 'in_catalogs': unicode([unicode(x) for x in self.in_catalogs]),
     return mimetype, data
 
 

Modified: csw/mgar/gar/v2/lib/web/pkgdb_web.py
===================================================================
--- csw/mgar/gar/v2/lib/web/pkgdb_web.py	2012-02-05 00:58:42 UTC (rev 16995)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py	2012-02-05 00:59:16 UTC (rev 16996)
@@ -277,10 +277,12 @@
     sqo_osrel, sqo_arch, sqo_catrel = pkgdb.GetSqoTriad(
         osrel_name, arch_name, catrel_name)
     pkgs = list(models.GetCatPackagesResult(sqo_osrel, sqo_arch, sqo_catrel))
+    user_data = web.input(quick='')
+    quick = (user_data.quick == "true")
     if not len(pkgs):
       raise web.notfound()
     web.header('Content-type', 'application/x-vnd.opencsw.pkg;type=srv4-list')
-    pkgs_data = [x.GetRestRepr()[1] for x in pkgs]
+    pkgs_data = [p.GetRestRepr(quick)[1] for p in pkgs]
     return json.dumps(pkgs_data)
 
 

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