Fix more unicode kwargs dict keys (#302)
This commit is contained in:
parent
af10e642f2
commit
542979f09a
@ -127,11 +127,16 @@ def model_json_decoder(dct):
|
||||
{u'a_track': Track(artists=[], name=u'name')}
|
||||
|
||||
"""
|
||||
# NOTE kwargs dict keys must be bytestrings to work on Python < 2.6.5
|
||||
# See https://github.com/mopidy/mopidy/issues/302 for details.
|
||||
if '__model__' in dct:
|
||||
model_name = dct.pop('__model__')
|
||||
cls = globals().get(model_name, None)
|
||||
if issubclass(cls, ImmutableObject):
|
||||
return cls(**dct)
|
||||
kwargs = {}
|
||||
for key, value in dct.items():
|
||||
kwargs[str(key)] = value
|
||||
return cls(**kwargs)
|
||||
return dct
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user