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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sat Mar 29 17:10:44 CET 2014


Revision: 23288
          http://sourceforge.net/p/gar/code/23288
Author:   wahwah
Date:     2014-03-29 16:10:43 +0000 (Sat, 29 Mar 2014)
Log Message:
-----------
pkgdb-web: Correct the type of 'size'

Static typing! The inbuilt JSON decoder in go can handle the size correctly
only when the JSON data structure is of the right type. If we want to
deserialize into an int, we need to have an int in the JSON data too.

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	2014-03-29 16:10:35 UTC (rev 23287)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py	2014-03-29 16:10:43 UTC (rev 23288)
@@ -705,7 +705,12 @@
     basename md5_sum size deps category i_deps
     """
     entries_list = GetCatalogEntries(catrel_name, arch_name, osrel_name)
-    response = cjson.encode([x._asdict() for x in entries_list])
+    response_list = []
+    for entry in entries_list:
+      entry_dict = entry._asdict()
+      entry_dict["size"] = int(entry_dict["size"])
+      response_list.append(entry_dict)
+    response = cjson.encode(response_list)
     web.header('Content-Length', str(len(response)))
     return 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