mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-15 04:45:49 +01:00
parent
e02245e422
commit
4b8b847544
@ -511,5 +511,9 @@ def _params_to_urlencoded(params):
|
|||||||
else:
|
else:
|
||||||
return str(o).encode('utf-8')
|
return str(o).encode('utf-8')
|
||||||
|
|
||||||
utf8_params = {encode(k): encode(v) for k, v in six.iteritems(params)}
|
#fix for python 2.6
|
||||||
|
utf8_params = {}
|
||||||
|
for k,v in six.iteritems(params):
|
||||||
|
utf8_params[encode(k)] = encode(v)
|
||||||
|
|
||||||
return url_encode(utf8_params)
|
return url_encode(utf8_params)
|
||||||
|
@ -237,11 +237,12 @@ class StoneToPythonPrimitiveSerializer(StoneSerializerBase):
|
|||||||
def encode_map(self, validator, value):
|
def encode_map(self, validator, value):
|
||||||
validated_value = validator.validate(value)
|
validated_value = validator.validate(value)
|
||||||
|
|
||||||
return {
|
#fix for python 2.6
|
||||||
self.encode_sub(validator.key_validator, key):
|
result = {}
|
||||||
self.encode_sub(validator.value_validator, value) for
|
for key, value in validated_value.items():
|
||||||
key, value in validated_value.items()
|
result[self.encode_sub(validator.key_validator,key)] = self.encode_sub(validator.value_validator, value)
|
||||||
}
|
|
||||||
|
return result
|
||||||
|
|
||||||
def encode_nullable(self, validator, value):
|
def encode_nullable(self, validator, value):
|
||||||
if value is None:
|
if value is None:
|
||||||
@ -830,11 +831,12 @@ def _decode_list(
|
|||||||
if not isinstance(obj, list):
|
if not isinstance(obj, list):
|
||||||
raise bv.ValidationError(
|
raise bv.ValidationError(
|
||||||
'expected list, got %s' % bv.generic_type_name(obj))
|
'expected list, got %s' % bv.generic_type_name(obj))
|
||||||
return [
|
|
||||||
_json_compat_obj_decode_helper(
|
result = []
|
||||||
data_type.item_validator, item, alias_validators, strict,
|
for item in obj:
|
||||||
old_style, for_msgpack)
|
result.append(_json_compat_obj_decode_helper(data_type.item_validator, item, alias_validators, strict,old_style, for_msgpack))
|
||||||
for item in obj]
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def _decode_map(
|
def _decode_map(
|
||||||
@ -846,15 +848,12 @@ def _decode_map(
|
|||||||
if not isinstance(obj, dict):
|
if not isinstance(obj, dict):
|
||||||
raise bv.ValidationError(
|
raise bv.ValidationError(
|
||||||
'expected dict, got %s' % bv.generic_type_name(obj))
|
'expected dict, got %s' % bv.generic_type_name(obj))
|
||||||
return {
|
|
||||||
_json_compat_obj_decode_helper(
|
result = {}
|
||||||
data_type.key_validator, key, alias_validators, strict,
|
for key, value in obj.items():
|
||||||
old_style, for_msgpack):
|
result[_json_compat_obj_decode_helper(data_type.key_validator, key, alias_validators, strict,old_style, for_msgpack)] = _json_compat_obj_decode_helper(data_type.value_validator, value, alias_validators, strict,old_style, for_msgpack)
|
||||||
_json_compat_obj_decode_helper(
|
|
||||||
data_type.value_validator, value, alias_validators, strict,
|
return result
|
||||||
old_style, for_msgpack)
|
|
||||||
for key, value in obj.items()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def _decode_nullable(
|
def _decode_nullable(
|
||||||
|
@ -422,10 +422,13 @@ class Map(Composite):
|
|||||||
def validate(self, val):
|
def validate(self, val):
|
||||||
if not isinstance(val, dict):
|
if not isinstance(val, dict):
|
||||||
raise ValidationError('%r is not a valid dict' % val)
|
raise ValidationError('%r is not a valid dict' % val)
|
||||||
return {
|
|
||||||
self.key_validator.validate(key):
|
#fix for python 2.6
|
||||||
self.value_validator.validate(value) for key, value in val.items()
|
result = {}
|
||||||
}
|
for key, value in val.items():
|
||||||
|
result[self.key_validator.validate(key)] = self.value_validator.validate(value)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
class Struct(Composite):
|
class Struct(Composite):
|
||||||
|
Loading…
Reference in New Issue
Block a user