#25541: Loading JSON fixture error location reporting
--------------------------------------+--------------------------------
     Reporter:  awol                  |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  Core (Serialization)  |    Version:  1.8
     Severity:  Normal                |   Keywords:  JSON fixture error
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+--------------------------------
 We load a lot of data from fixtures that we generate from a CSV based data
 source. The transformation from CSV to JSON for the fixture is mostly fine
 but from time to time as the model changes or someone adds a different
 instance of the CSV data set, the fixture that gets created will fail to
 load for one reason or another. It is very hard/impossible to know which
 "line" in the fixture caused the exception that prevents the whole fixture
 from loading.

 I am not sure what the most appropriate Django like fix for this issue is,
 however I have found that the following change is very successful at
 helping me find the appropriate place in the fixture JSON file and would
 appreciate if something along these lines would be available in the
 project.

 {{{
 django/core/serializers/json.py 2015-10-11 22:30:32.590127937 +1100
 ***************
 *** 82,87 ****
 --- 82,88 ----
           raise
       except Exception as e:
           # Map to deserializer error
 +        e.message += " Last success '{}:
 {}'.".format(obj.object.__class__.__name__, obj.object)
           six.reraise(DeserializationError, DeserializationError(e),
 sys.exc_info()[2])
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25541>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/047.344d0fe67499cc7f23e8a76129e28cd3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to