[csw-devel] SF.net SVN: gar:[13199] csw/mgar/gar/v2/lib/web/pkgdb_web.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sat Feb 5 20:36:48 CET 2011


Revision: 13199
          http://gar.svn.sourceforge.net/gar/?rev=13199&view=rev
Author:   wahwah
Date:     2011-02-05 19:36:48 +0000 (Sat, 05 Feb 2011)

Log Message:
-----------
pkgdb_web: A URL to return a whole catalog

Slow (~30s), but useful to diff catalogs.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/web/pkgdb_web.py

Modified: csw/mgar/gar/v2/lib/web/pkgdb_web.py
===================================================================
--- csw/mgar/gar/v2/lib/web/pkgdb_web.py	2011-02-05 19:36:20 UTC (rev 13198)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py	2011-02-05 19:36:48 UTC (rev 13199)
@@ -23,6 +23,7 @@
   r'/maintainers/(\d+)/checkpkg/', 'MaintainerCheckpkgReport',
   r'/error-tags/', 'ErrorTagList',
   r'/catalognames/([^/]+)/', 'Catalogname',
+  r'/rest/catalogs/([^/]+)/([^/]+)/([^/]+)/', 'Catalogs',
   r'/rest/catalogs/([^/]+)/([^/]+)/([^/]+)/pkgname-by-filename',
       'PkgnameByFilename',
   r'/rest/srv4/([0-9a-f]{32})/', 'RestSrv4Detail',
@@ -170,6 +171,19 @@
     return render.ErrorTagList(tag_names)
 
 
+class Catalogs(object):
+  def GET(self, catrel_name, arch_name, osrel_name):
+    ConnectToDatabase()
+    sqo_osrel, sqo_arch, sqo_catrel = pkgdb.GetSqoTriad(
+        osrel_name, arch_name, catrel_name)
+    pkgs = list(models.GetCatPackagesResult(sqo_osrel, sqo_arch, sqo_catrel))
+    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]
+    return json.dumps(pkgs_data)
+
+
 class PkgnameByFilename(object):
   def GET(self, catrel, arch, osrel):
     ConnectToDatabase()


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