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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Fri Jan 20 10:45:15 CET 2012


Revision: 16844
          http://gar.svn.sourceforge.net/gar/?rev=16844&view=rev
Author:   wahwah
Date:     2012-01-20 09:45:15 +0000 (Fri, 20 Jan 2012)
Log Message:
-----------
pkgdb-web: RESTful maintainer data (read-only)

There isn't much of that data, we don't have the maintainer status, for
example. The only two fields are email and the full name.

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-01-20 09:44:41 UTC (rev 16843)
+++ csw/mgar/gar/v2/lib/python/models.py	2012-01-20 09:45:15 UTC (rev 16844)
@@ -63,6 +63,13 @@
         self.full_name or "Maintainer full name unknown",
         self.ObfuscatedEmail())
 
+  def GetRestRepr(self):
+    return {
+        'maintainer_email': self.email,
+        'maintainer_full_name': self.full_name,
+        'maintainer_id': self.id,
+    }
+
 class Host(sqlobject.SQLObject):
   "Hostname, as returned by socket.getfqdn()"
   fqdn = sqlobject.UnicodeCol(length=255, unique=True, notNone=True)
@@ -262,6 +269,7 @@
         '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,

Modified: csw/mgar/gar/v2/lib/web/pkgdb_web.py
===================================================================
--- csw/mgar/gar/v2/lib/web/pkgdb_web.py	2012-01-20 09:44:41 UTC (rev 16843)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py	2012-01-20 09:45:15 UTC (rev 16844)
@@ -35,6 +35,7 @@
   # Query by catalog release, arch, OS release and catalogname
   r'/rest/catalogs/([^/]+)/(sparc|i386)/(SunOS[^/]+)/catalognames/([^/]+)/', 'Srv4ByCatAndCatalogname',
   r'/rest/catalogs/([^/]+)/(sparc|i386)/(SunOS[^/]+)/pkgnames/([^/]+)/', 'Srv4ByCatAndPkgname',
+  r'/rest/maintainers/([0-9]+)/', 'RestMaintainerDetail',
   r'/rest/srv4/([0-9a-f]{32})/', 'RestSrv4Detail',
   r'/rest/srv4/([0-9a-f]{32})/files/', 'RestSrv4DetailFiles',
   r'/rest/srv4/([0-9a-f]{32})/pkg-stats/', 'RestSrv4FullStats',
@@ -187,6 +188,13 @@
     return render.MaintainerDetail(maintainer, pkgs)
 
 
+class RestMaintainerDetail(object):
+  def GET(self, id):
+    ConnectToDatabase()
+    maintainer = models.Maintainer.selectBy(id=id).getOne()
+    return json.dumps(maintainer.GetRestRepr())
+
+
 class MaintainerCheckpkgReport(object):
   def GET(self, id):
     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