summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Aguilar <roberto@baremetal.io>2013-09-06 19:24:55 +0000
committerRoberto Aguilar <roberto@baremetal.io>2013-09-06 20:33:23 +0000
commit076cf131ec8084ce6d9cc3a05b0f4bcc167d6cbc (patch)
treec6e315baddfe383f0b5227ece331e0bc48a4c4d2
parentc72392dab4b4cf6f5d9b35a3dcb582fbfe38ebb8 (diff)
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.
-rw-r--r--django/core/management/commands/dumpdata.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/django/core/management/commands/dumpdata.py b/django/core/management/commands/dumpdata.py
index c74eede846..ed58ec79a1 100644
--- a/django/core/management/commands/dumpdata.py
+++ b/django/core/management/commands/dumpdata.py
@@ -106,11 +106,11 @@ class Command(BaseCommand):
# 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():