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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Nov 25 10:30:36 CET 2012


Revision: 19741
          http://gar.svn.sourceforge.net/gar/?rev=19741&view=rev
Author:   wahwah
Date:     2012-11-25 09:30:35 +0000 (Sun, 25 Nov 2012)
Log Message:
-----------
pkgdb: New URL to list all existing 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	2012-11-25 09:29:54 UTC (rev 19740)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py	2012-11-25 09:30:35 UTC (rev 19741)
@@ -38,6 +38,7 @@
   r'/catalognames/([^/]+)/', 'Catalogname',
 )
 urls_rest = (
+  r'/rest/catalogs/', 'RestCatalogList',
   r'/rest/catalogs/([^/]+)/(sparc|i386)/(SunOS[^/]+)/', 'Catalogs',
   r'/rest/catalogs/([^/]+)/(sparc|i386)/(SunOS[^/]+)/pkgname-by-filename',
       'PkgnameByFilename',
@@ -439,7 +440,22 @@
     except sqlobject.dberrors.OperationalError, e:
       raise web.internalerror(e)
 
+class RestCatalogList(object):
+  def GET(self):
+    archs = models.Architecture.select()
+    osrels = models.OsRelease.select()
+    catrels = models.CatalogRelease.select()
+    catalogs = []
+    for catrel in catrels:
+      for arch in archs:
+        if arch.name in ('all'): continue
+        for osrel in osrels:
+          if osrel.full_name == 'unspecified': continue
+          key = [osrel.short_name, arch.name, catrel.name]
+          catalogs.append(key)
+    return cjson.encode(catalogs)
 
+
 web.webapi.internalerror = web.debugerror
 
 

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