From 5797c8167ae651be3705406584ee443a442e8cd9 Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Mon, 9 Aug 2010 16:45:26 -0400 Subject: Make LDAPObject classes JSON serializable. --- ipalib/util.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ipalib/util.py') diff --git a/ipalib/util.py b/ipalib/util.py index 570d66e0..ba111d46 100644 --- a/ipalib/util.py +++ b/ipalib/util.py @@ -31,6 +31,12 @@ from ipalib import errors from ipapython import dnsclient +def json_serialize(obj): + if not callable(getattr(obj, '__json__', None)): + # raise TypeError('%r is not JSON serializable') + return '' + return obj.__json__() + def get_current_principal(): try: return unicode(krbV.default_context().default_ccache().principal().name) -- cgit