﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16850	Testsuite failing on JSON serialization	Raphael Hertzog <hertzog@…>	nobody	"Trying to build Django 1.3.1 on Debian unstable with python 2.6 and python-simplejson 2.2.0 installed I get two test suite failures.

Without python-simplejson

{{{
======================================================================
ERROR: test_serialize_unicode (modeltests.serializers.tests.JsonSerializerTestCase)
Tests that unicode makes the roundtrip intact
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""/home/rhertzog/deb/pkg/TEAMS/build-area/python-django-1.3.1/tests/modeltests/serializers/tests.py"", line 172, in test_serialize_unicode
    obj_list = list(serializers.deserialize(self.serializer_name, serial_str))
  File ""/home/rhertzog/deb/pkg/TEAMS/build-area/python-django-1.3.1/django/core/serializers/json.py"", line 35, in Deserializer
    for obj in PythonDeserializer(simplejson.load(stream), **options):
  File ""/home/rhertzog/deb/pkg/TEAMS/build-area/python-django-1.3.1/django/core/serializers/python.py"", line 128, in Deserializer
    data[field.name] = field.to_python(field_value)
  File ""/home/rhertzog/deb/pkg/TEAMS/build-area/python-django-1.3.1/django/db/models/fields/__init__.py"", line 761, in to_python
    return decimal.Decimal(value)
  File ""/usr/lib/python2.6/decimal.py"", line 649, in __new__
    ""First convert the float to a string"")
TypeError: Cannot convert float to Decimal.  First convert the float to a string

======================================================================
ERROR: test_json_serializer (regressiontests.serializers_regress.tests.SerializerTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""/home/rhertzog/deb/pkg/TEAMS/build-area/python-django-1.3.1/django/utils/functional.py"", line 55, in _curried
    return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
  File ""/home/rhertzog/deb/pkg/TEAMS/build-area/python-django-1.3.1/tests/regressiontests/serializers_regress/tests.py"", line 373, in serializerTest
    for obj in serializers.deserialize(format, serialized_data):
  File ""/home/rhertzog/deb/pkg/TEAMS/build-area/python-django-1.3.1/django/core/serializers/json.py"", line 35, in Deserializer
    for obj in PythonDeserializer(simplejson.load(stream), **options):
  File ""/home/rhertzog/deb/pkg/TEAMS/build-area/python-django-1.3.1/django/core/serializers/python.py"", line 128, in Deserializer
    data[field.name] = field.to_python(field_value)
  File ""/home/rhertzog/deb/pkg/TEAMS/build-area/python-django-1.3.1/django/db/models/fields/__init__.py"", line 761, in to_python
    return decimal.Decimal(value)
  File ""/usr/lib/python2.6/decimal.py"", line 649, in __new__
    ""First convert the float to a string"")
TypeError: Cannot convert float to Decimal.  First convert the float to a string
}}}

I also filed https://github.com/simplejson/simplejson/issues/17 because I'm not sure whether Django is improperly using simplejson or whether simplejson has a bug."	Bug	closed	Core (Serialization)	1.3	Normal	fixed			Accepted	0	0	0	0	0	0
