mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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
This commit is contained in:
committed by
Endi S. Dewata
parent
b069af3bc9
commit
3ac3130fc9
@@ -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):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user