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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sat Apr 20 16:37:18 CEST 2013


Revision: 20828
          http://gar.svn.sourceforge.net/gar/?rev=20828&view=rev
Author:   wahwah
Date:     2013-04-20 14:37:17 +0000 (Sat, 20 Apr 2013)
Log Message:
-----------
releases-web: Use cjson for encoding

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

Modified: csw/mgar/gar/v2/lib/web/releases_web.py
===================================================================
--- csw/mgar/gar/v2/lib/web/releases_web.py	2013-04-20 14:37:05 UTC (rev 20827)
+++ csw/mgar/gar/v2/lib/web/releases_web.py	2013-04-20 14:37:17 UTC (rev 20828)
@@ -9,7 +9,7 @@
 import base64
 import web
 import sqlobject
-import json
+import cjson
 from lib.python import models
 from lib.python import configuration
 from lib.python import pkgdb
@@ -80,7 +80,7 @@
         "declared_md5": declared_md5_sum,
         "save_attempt": save_attempt,
     })
-    return json.dumps(messages)
+    return cjson.encode(messages)
 
 
 class Srv4Detail(object):
@@ -118,7 +118,7 @@
         "arch": srv4.arch.name,
         "osrel": srv4.os_rel.short_name,
     }
-    return json.dumps(response_data)
+    return cjson.encode(response_data)
 
 
 class Srv4CatalogAssignment(object):
@@ -140,7 +140,7 @@
     response_data = {
         'srv': unicode(srv4),
     }
-    return json.dumps(response_data)
+    return cjson.encode(response_data)
 
   def PUT(self, catrel_name, arch_name, osrel_name, md5_sum):
     """Adds package to a catalog.
@@ -200,7 +200,7 @@
       web.header(
           'Content-type',
           'application/x-vnd.opencsw.pkg;type=catalog-update')
-      response = json.dumps([
+      response = cjson.encode([
         u"Added to catalog %s %s %s" % (catrel_name, arch_name, osrel_name),
         u"%s" % srv4.basename,
       ])
@@ -212,7 +212,7 @@
       web.header(
           'Content-type',
           'application/x-vnd.opencsw.pkg;type=error-message')
-      response = json.dumps({
+      response = cjson.encode({
         "error_message": unicode(e),
       })
       web.header('Content-Length', len(response))
@@ -241,7 +241,7 @@
     web.header(
         'Content-type',
         'application/x-vnd.opencsw.pkg;type=error-message')
-    response = json.dumps({
+    response = cjson.encode({
       "error_message": unicode(message),
     })
     web.header('Content-Length', len(response))

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