LazyEncoder in serialization docs is incorrect
http://docs.djangoproject.com/en/dev/topics/serialization:
from django.utils.functional import Promise
from django.utils.encoding import force_unicode
class LazyEncoder(simplejson.JSONEncoder):
def default(self, obj):
if isinstance(obj, Promise):
return force_unicode(obj)
return obj
This causes "object is not JSON serializable" errors to be turned into "ValueError: Circular reference detected".
Change History
(6)
Patch needs improvement: |
set
|
Triage Stage: |
Unreviewed → Accepted
|
milestone: |
→ 1.1
|
Patch needs improvement: |
unset
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
That should be super(LazyEncoder