Commit e476dcb8 by Danilo Bargen

Changed AttributeError to AssertionError

parent ec4d79bc
......@@ -424,9 +424,8 @@ class ModelSerializer(Serializer):
"""
cls = self.opts.model
if cls is None:
raise AttributeError("Serializer class '%s' is missing 'model' Meta option" %
self.__class__.__name__)
assert cls is not None, \
"Serializer class '%s' is missing 'model' Meta option" % self.__class__.__name__
opts = get_concrete_model(cls)._meta
pk_field = opts.pk
# while pk_field.rel:
......
......@@ -365,7 +365,7 @@ class ValidationTests(TestCase):
"""
try:
serializer = BrokenModelSerializer()
except AttributeError as e:
except AssertionError as e:
self.assertEquals(e.args[0], "Serializer class 'BrokenModelSerializer' is missing 'model' Meta option")
except:
self.fail('Wrong exception type thrown.')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment