#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>