From aae6c023fa2701c964a8cf7f9d1ee2fb7d06b94c Mon Sep 17 00:00:00 2001 From: Tibabal Date: Fri, 21 Nov 2014 16:22:37 +0100 Subject: [PATCH] Update datatypes.py to handle dict on properties As a dict's iterator returns keys, sending {"key" : "value"} resulted in receiving ["key"] on dashboard Uses dict.iteritems() instead --- parse_rest/datatypes.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/parse_rest/datatypes.py b/parse_rest/datatypes.py index 5e0a1ac..96a4cb7 100644 --- a/parse_rest/datatypes.py +++ b/parse_rest/datatypes.py @@ -70,7 +70,12 @@ def convert_to_parse(python_object, as_pointer=False): if (hasattr(python_object, '__iter__') and not isinstance(python_object, (six.string_types[0], ParseType))): # It's an iterable? Repeat this whole process on each object - return [ParseType.convert_to_parse(o, as_pointer=as_pointer) + if isinstance(python_object, dict): + for key, value in python_object.iteritems(): + python_object[key]=ParseType.convert_to_parse(value, as_pointer=as_pointer) + return python_object + else: + return [ParseType.convert_to_parse(o, as_pointer=as_pointer) for o in python_object] if python_type in transformation_map: