Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 076cf131ec8084ce6d9cc3a05b0f4bcc167d6cbc 1 parent c72392d
Roberto Aguilar authored September 06, 2013
8  django/core/management/commands/dumpdata.py
@@ -106,11 +106,11 @@ def handle(self, *app_labels, **options):
106 106
         # Check that the serialization format exists; this is a shortcut to
107 107
         # avoid collating all the objects and _then_ failing.
108 108
         if format not in serializers.get_public_serializer_formats():
109  
-            raise CommandError("Unknown serialization format: %s" % format)
  109
+            try:
  110
+                serializers.get_serializer(format)
  111
+            except serializers.SerializerDoesNotExist:
  112
+                pass
110 113
 
111  
-        try:
112  
-            serializers.get_serializer(format)
113  
-        except KeyError:
114 114
             raise CommandError("Unknown serialization format: %s" % format)
115 115
 
116 116
         def get_objects():

0 notes on commit 076cf13

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