#10200: loaddata command does not raise CommandError on errors
---------------------------------------------+------------------------------
          Reporter:  lgs                     |         Owner:  nobody
            Status:  new                     |     Milestone:        
         Component:  Serialization           |       Version:  1.0   
        Resolution:                          |      Keywords:        
             Stage:  Design decision needed  |     Has_patch:  1     
        Needs_docs:  0                       |   Needs_tests:  0     
Needs_better_patch:  0                       |  
---------------------------------------------+------------------------------
Comment (by pmocek):

 I noticed what is likely a related problem.  When the loaddata
 command is used with the auto-generated manage.py, bad syntax
 results in silent failure and a return code indicating success.

 The built-in usage help shows that the fixture argument is
 mandatory:

 {{{
 Usage: manage.py loaddata [options] fixture [fixture ...]
 }}}

 However, manage.py does not report an error when a fixture is not
 specified:

 {{{
 $ ./manage.py loaddata
 $ echo $?
 0
 }}}

 Only when the verbosity level is increased from 0 to 2 is an error
 reported, and the return code still indicates success:

 {{{
 $ ./manage.py loaddata --verbosity=1 ; echo $?
 0
 $ ./manage.py loaddata --verbosity=2 ; echo $?
 No fixtures found.
 0
 }}}

 Typically, silence implies successful completion.  This problem is
 particularly troublesome because the syntax for loaddata differs
 significantly from that of dumpdata.  It took
 [http://groups.google.com/group/django-
 users/browse_frm/thread/d1a7de5a4efc58cb outside assistance]
 for me -- new to Django but with a considerable amount of experience
 using CLI utilities -- to determine why the following commands
 completed with apparent success but left my database empty:

 {{{
 $ ./manage.py dumpdata >data.json
 $ ./manage.ph flush
 $ ./manage.py loaddata <data.json
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10200#comment:5>
Django <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 django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to