Django

Code

Ticket #7254 (closed: fixed)

Opened 2 months ago

Last modified 2 weeks ago

patch: exclude apps from dumpdir

Reported by: Carl Karsten <carl@personnelware.com> Assigned to: nobody
Milestone: Component: django-admin.py
Version: SVN Keywords:
Cc: "Russell, Keith-Magee", <freakboy3742@gmail.com> Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

Description

To help deal with loaddata issues caused by a single app (like http://code.djangoproject.com/ticket/7052 ) this adds support for --exclude to dumpdata. (use multiple --exclude to exclude multiple apps.)

It also adds --verbosity which shows lets you see what apps have been excluded, what will be processed, and what is being processed as the data is being dumped. It sends this to stderr because dumpdata currently sends to stdout.

If stderr is poor form, I was considering adding a --file option so that sdtout could be used for verbosity messages. but that seemed just as wrong as stderr, and stderr was much easier to code.

Attachments

dumpdata.py.diff (3.5 kB) - added by Carl Karsten <carl@personnelware.com> on 05/17/08 14:24:29.
dumpdata.py.2.diff (3.3 kB) - added by Carl Karsten <carl@personnelware.com> on 05/27/08 09:03:41.
removed unnecessary changes, s/print stderr/sys.stderr.write

Change History

05/17/08 14:24:29 changed by Carl Karsten <carl@personnelware.com>

  • attachment dumpdata.py.diff added.

05/27/08 06:10:47 changed by toxik

  • needs_better_patch set to 1.

There are unnecessary changes in the patch. Please have them removed.

     option_list = BaseCommand.option_list + (
-        make_option('--format', default='json', dest='format',
+        make_option('--format', dest='format', default='json',
             help='Specifies the output serialization format for fixtures.'),
-        make_option('--indent', default=None, dest='indent', type='int',
+        make_option('--indent', dest='indent', type='int', default=None,
             help='Specifies the indent level to use when pretty-printing output'),

Also, the direct usage of stderr is layer violation, AFAICT.

05/27/08 09:03:41 changed by Carl Karsten <carl@personnelware.com>

  • attachment dumpdata.py.2.diff added.

removed unnecessary changes, s/print stderr/sys.stderr.write

06/10/08 21:32:27 changed by programmerq

  • stage changed from Unreviewed to Design decision needed.

06/11/08 01:06:29 changed by Carl Karsten <carl@personnelware.com>

  • cc set to "Russell, Keith-Magee", <freakboy3742@gmail.com>.

Russ - you kinda mentored me on this - mind chiming in?

06/11/08 01:13:13 changed by russellm

  • stage changed from Design decision needed to Accepted.

This is a reasonable idea, especially as a workaround for #7052 issues. I can't review the patch right now, but I should have a chance in the near future.

06/11/08 09:01:36 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

(In [7615]) Fixed #7254 -- Added an '--exclude' option to dumpdata, allowing specific applications to be removed from the dump output. Thanks to Carl Karsten for the idea and patch.

06/24/08 10:37:41 changed by Carl Karsten <carl@personnelware.com>

What happened to

make_option('-v', '--verbosity', action='store', dest='verbosity', default='0',

?

06/24/08 17:38:43 changed by russellm

On looking at the patch, I couldn't see the value in the output being provided by verbosity - it was useful output for debugging the command itself, but I didn't see the value for end users.


Add/Change #7254 (patch: exclude apps from dumpdir)




Change Properties
Action