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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Thu Dec 27 18:47:31 CET 2012


Revision: 19970
          http://gar.svn.sourceforge.net/gar/?rev=19970&view=rev
Author:   wahwah
Date:     2012-12-27 17:47:30 +0000 (Thu, 27 Dec 2012)
Log Message:
-----------
pkgdb-web: Don't crash on missing release

The process was getting restarted on the server anyway, but it's cleaner to
serve a 404 instead.

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-12-27 17:30:03 UTC (rev 19969)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py	2012-12-27 17:47:30 UTC (rev 19970)
@@ -378,8 +378,11 @@
   def GET(self, catrel_name, arch_name, osrel_name, catalogname):
     """Get a srv4 reference by catalog ane catalogname."""
     configuration.SetUpSqlobjectConnection()
-    sqo_osrel, sqo_arch, sqo_catrel = pkgdb.GetSqoTriad(
-        osrel_name, arch_name, catrel_name)
+    try:
+      sqo_osrel, sqo_arch, sqo_catrel = pkgdb.GetSqoTriad(
+          osrel_name, arch_name, catrel_name)
+    except sqlobject.main.SQLObjectNotFound:
+      raise web.notfound()
     join = [
         sqlbuilder.INNERJOINOn(None,
           models.Srv4FileInCatalog,
@@ -401,7 +404,7 @@
       web.header('Access-Control-Allow-Origin', '*')
       return cjson.encode(data)
     except sqlobject.main.SQLObjectNotFound:
-      return cjson.encode(None)
+      raise web.notfound()
     except sqlobject.dberrors.OperationalError, e:
       raise web.internalerror(e)
 

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