Make LDAPObject classes JSON serializable.

This commit is contained in:
Pavel Zuna
2010-08-09 16:45:26 -04:00
committed by Rob Crittenden
parent 9d9d789912
commit 5797c8167a
2 changed files with 23 additions and 0 deletions

View File

@@ -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)