Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Moved get_serializer() call in dumpdata command.

Moved the get_serializer() call within the condition that checks public
serializers.  This will allow exceptions other than
SerializerDoesNotExist to be raised in order to provide the caller with
useful information, e.g when pyyaml is not installed.
  • Loading branch information...
1 parent c72392d commit 076cf131ec8084ce6d9cc3a05b0f4bcc167d6cbc @rca rca committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 django/core/management/commands/
8 django/core/management/commands/
@@ -106,11 +106,11 @@ def handle(self, *app_labels, **options):
# Check that the serialization format exists; this is a shortcut to
# avoid collating all the objects and _then_ failing.
if format not in serializers.get_public_serializer_formats():
- raise CommandError("Unknown serialization format: %s" % format)
+ try:
+ serializers.get_serializer(format)
+ except serializers.SerializerDoesNotExist:
+ pass
- try:
- serializers.get_serializer(format)
- except KeyError:
raise CommandError("Unknown serialization format: %s" % format)
def get_objects():

0 comments on commit 076cf13

Please sign in to comment.
Something went wrong with that request. Please try again.