summaryrefslogtreecommitdiffstats
path: root/ipalib/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib/util.py')
-rw-r--r--ipalib/util.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/ipalib/util.py b/ipalib/util.py
index 44f08e7f6..155d93294 100644
--- a/ipalib/util.py
+++ b/ipalib/util.py
@@ -26,6 +26,7 @@ import imp
import time
import socket
import re
+import decimal
from types import NoneType
from weakref import WeakKeyDictionary
from dns import resolver, rdatatype
@@ -46,6 +47,8 @@ def json_serialize(obj):
return obj
if isinstance(obj, str):
return obj.decode('utf-8')
+ if isinstance(obj, (decimal.Decimal, DN)):
+ return str(obj)
if not callable(getattr(obj, '__json__', None)):
# raise TypeError('%r is not JSON serializable')
return ''