def _to_dict(self, o):
"""
Convert a given object to dict.
:param o: The object to be converted.
:return dict: The dict value converted.
"""
if isinstance(o, MutableMapping):
return o
if not isinstance(o, string_types):
raise TypeError('Expected str, got %s' % text_type(type(o)))
pairs = o.split(self.dict_delimiter)
d = IgnoreCaseDict()
for pair in pairs:
kv = pair.split('=')
key = kv[0].strip()
value = kv[1].strip()
d[key] = value
return d
评论列表
文章目录