#3324: FloatFields are converted to decimal and simplejson cannot serialize
------------------------------+---------------------------------------------
   Reporter:  [EMAIL PROTECTED]  |                Owner:  jacob        
     Status:  reopened        |            Component:  Serialization
    Version:  SVN             |           Resolution:               
   Keywords:  json decimal    |                Stage:  Accepted     
  Has_patch:  1               |           Needs_docs:  0            
Needs_tests:  0               |   Needs_better_patch:  0            
------------------------------+---------------------------------------------
Changes (by Jorge Gajon <[EMAIL PROTECTED]>):

  * keywords:  => json decimal

Comment:

 Hello,
 
 Since modifying the bundled simplejson library might not be very
 desirable, I would like to propose an alternative patch to the one
 submitted above by Eric. Django already subclasses
 "simplejson.JSONEncoder" in the file "django/core/serializers/json.py" to
 handle Date/Time types, so I believe it would be better to add a check
 there to also handle Decimal objects.
 
 Since decimal is not included with Python 2.3 the patch does a simple
 check to see if it is available, and if it isn't, then it doesn't bother
 to check the object type. I also renamed this subclass because it no
 longer deals only with DateTime objects.
 
 I tested this patch on my machine and so far it works fine. I can now do a
 "./manage.py dumpdata --format=json app" when using a MySQL database.
 
 I'll appreciate any comments on this patch.
 
 Thanks!

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3324#comment:10>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to