From 5003df3659f8f6d32f60bab8c409a1159cc956a1 Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Sat, 17 Dec 2011 23:00:41 +0000 Subject: [PATCH] Tweaked changes from r17228 to cater for older simplejson versions. dump() started accepting the `use_decimal` argument in 2.1.3. Refs #16850. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17229 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/serializers/json.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/django/core/serializers/json.py b/django/core/serializers/json.py index c2407d2a712..7b570f36d8c 100644 --- a/django/core/serializers/json.py +++ b/django/core/serializers/json.py @@ -18,7 +18,9 @@ class Serializer(PythonSerializer): 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):