summaryrefslogtreecommitdiffstats
path: root/ipaserver/rpcserver.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2011-02-10 13:29:52 -0500
committerEndi S. Dewata <edewata@redhat.com>2011-02-11 13:36:15 -0500
commit3ac3130fc9daf853368947b268d9af4b8a67d247 (patch)
tree404d1bdf4814e6e9b58394049d1c377c7a75f7af /ipaserver/rpcserver.py
parentb069af3bc9fe5ad91c01a0d7b4f7c9d833291e23 (diff)
downloadfreeipa-3ac3130fc9daf853368947b268d9af4b8a67d247.tar.gz
freeipa-3ac3130fc9daf853368947b268d9af4b8a67d247.tar.xz
freeipa-3ac3130fc9daf853368947b268d9af4b8a67d247.zip
Convert json strings to unicode when they are unmarshalled.
This patch removes some individual work-arounds of converting strings to unicode, they only masked the problem. String values are not passed to the validator or normalizers so things like adding the realm automatically to services weren't happening. ticket 941
Diffstat (limited to 'ipaserver/rpcserver.py')
-rw-r--r--ipaserver/rpcserver.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
index fb86a21e..ff2b04b5 100644
--- a/ipaserver/rpcserver.py
+++ b/ipaserver/rpcserver.py
@@ -27,7 +27,7 @@ from cgi import parse_qs
from xml.sax.saxutils import escape
from xmlrpclib import Fault
from ipalib.backend import Executioner
-from ipalib.errors import PublicError, InternalError, CommandError, JSONError
+from ipalib.errors import PublicError, InternalError, CommandError, JSONError, ConversionError
from ipalib.request import context, Connection, destroy_context
from ipalib.rpc import xml_dumps, xml_loads
from ipalib.util import make_repr
@@ -402,7 +402,16 @@ def json_decode_binary(val):
del val
return new_list
else:
- return val
+ if isinstance(val, basestring):
+ try:
+ return val.decode('utf-8')
+ except UnicodeDecodeError:
+ raise ConversionError(
+ name=val,
+ error='incorrect type'
+ )
+ else:
+ return val
class jsonserver(WSGIExecutioner):
"""