Commits

Matthew Schinckel committed 971069a

Provide a better error message when we can't work out what the content-type should be.

  • Participants
  • Parent commits e981778

Comments (0)

Files changed (1)

File repose/views.py

             if self.etag_function:
                 response['Etag'] = etag
         
-        content_type = serializers.get_preferred_content_type(request)
+        content_type = serializers.get_preferred_content_type(request)   
         serializer = serializers.get_serializer(content_type)
         
+        if not serializer:
+            response = http.NotAcceptable("Unable to determine content-type")
+            response.request = request
+            return response
+        
         response.content_type = serializer.content_type
         response.template_name = self.template_name
         response.request = request