Author: ramiro
Date: 2011-12-17 15:00:41 -0800 (Sat, 17 Dec 2011)
New Revision: 17229

Modified:
   django/trunk/django/core/serializers/json.py
Log:
Tweaked changes from r17228 to cater for older simplejson versions.

dump() started accepting the `use_decimal` argument in 2.1.3.

Refs #16850.

Modified: django/trunk/django/core/serializers/json.py
===================================================================
--- django/trunk/django/core/serializers/json.py        2011-12-17 22:10:37 UTC 
(rev 17228)
+++ django/trunk/django/core/serializers/json.py        2011-12-17 23:00:41 UTC 
(rev 17229)
@@ -18,7 +18,9 @@
     internal_use_only = False
 
     def end_serialization(self):
-        self.options.update({'use_decimal': False}) # Use JS strings to 
represent Python Decimal instances (ticket #16850)
+        if simplejson.__version__.split('.') >= ['2', '1', '3']:
+            # Use JS strings to represent Python Decimal instances (ticket 
#16850)
+            self.options.update({'use_decimal': False})
         simplejson.dump(self.objects, self.stream, cls=DjangoJSONEncoder, 
**self.options)
 
     def getvalue(self):

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to