#36608: dumpdata does not use custom serializers
-------------------------------------+-------------------------------------
     Reporter:  ksauder              |                    Owner:  (none)
         Type:  Uncategorized        |                   Status:  closed
    Component:  Core (Management     |                  Version:  5.2
  commands)                          |
     Severity:  Release blocker      |               Resolution:  invalid
     Keywords:  dumpdata custom      |             Triage Stage:
  serializers                        |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by ksauder):

 Well, the code is a little broken. It doesn't actually raise a more
 appropriate message, and the docs do not actually point out that
 `internal_use_only` flag must be unset for it to work from the command
 line. I would suggest a change along the lines of this:


 {{{
 diff --git a/django/core/management/commands/dumpdata.py
 b/django/core/management/commands/dumpdata.py
 index 15e615c1d0..9ec9ab76a3 100644
 --- a/django/core/management/commands/dumpdata.py
 +++ b/django/core/management/commands/dumpdata.py
 @@ -177,9 +177,8 @@ class Command(BaseCommand):
              try:
                  serializers.get_serializer(format)
              except serializers.SerializerDoesNotExist:
 -                pass
 -
 -            raise CommandError("Unknown serialization format: %s" %
 format)
 +                raise CommandError("Unknown serialization format: %s" %
 format)
 +            # We found it, but it's not a public serializer. Let the user
 know
 +            raise CommandError("Serialization format %s is flagged for
 internal_use_only. Set internal_use_only = False in the Serializer to use
 it here." % format)

          def get_objects(count_only=False):
              """
 }}}

 And/or call out the `internal_use_only` flag near the custom serialization
 doc and its affect on CLI operation.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36608#comment:3>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019943da749c-77fd8bc0-da56-4079-a8e7-60193007b9f8-000000%40eu-central-1.amazonses.com.

Reply via email to