Numbers of long type were incorrectly serialized to JSON as empty strings when using json_serialize function. It caused problem in serialization of metadata for Web UI. This patch is fixing it.

Discovered after "Cast DNS SOA serial maximum boundary to long"
--
Petr Vobornik
From df9d2f4ae8696f655a4e35b73508a25483be39ad Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Tue, 11 Sep 2012 14:31:13 +0200
Subject: [PATCH] JSON serialization of long type

Numbers of long type were incorrectly serialized to JSON as empty strings when using json_serialize function. It caused problem in serialization of metadata for Web UI. This patch is fixing it.

Discovered after "Cast DNS SOA serial maximum boundary to long"
---
 ipalib/util.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipalib/util.py b/ipalib/util.py
index ca71e78dbe478f033e52e60ac9426d3b3f12b330..1d5900924135f427da48df6b5693b686ae89eb7f 100644
--- a/ipalib/util.py
+++ b/ipalib/util.py
@@ -43,7 +43,7 @@ def json_serialize(obj):
         return [json_serialize(o) for o in obj]
     if isinstance(obj, dict):
         return dict((k, json_serialize(v)) for (k, v) in obj.iteritems())
-    if isinstance(obj, (bool, float, int, unicode, NoneType)):
+    if isinstance(obj, (bool, float, int, long, unicode, NoneType)):
         return obj
     if isinstance(obj, str):
         return obj.decode('utf-8')
-- 
1.7.11.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to