Commit e4375202 by Timo Tuominen

Generator implementation of class mapping.

parent 582f6fdd
......@@ -633,11 +633,10 @@ def _get_class_mapping(mapping, obj):
from the dictionary or None.
"""
for baseclass in inspect.getmro(obj.__class__):
val = mapping.get(baseclass)
if val:
return val
return None
return next(
(mapping[cls] for cls in inspect.getmro(obj.__class__) if cls in mapping),
None
)
class ModelSerializer(Serializer):
......
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