clarkduvall / serpy

ridiculously fast object serialization
http://serpy.readthedocs.org/en/latest/
MIT License
960 stars 62 forks source link

Methods are not overridden by the child class's implementation #31

Closed jscn closed 8 years ago

jscn commented 8 years ago

If I have a serializer, TopLevelSerializer with a MethodField which uses a method get_thing to calculate the value of the field, when I create another serializer which inherits from TopLevelSerializer and re-implement get_thing on that child class, I expect the child class's implementation of get_thing to be called when I serialize an object with the child class. However, the TopLevelSerializer's implementation is always called. This breaks the standard way that inheritance is supposed to work in Python.

jscn commented 8 years ago

The above PR just demonstrates the issue at the moment. I'll try and get a fix together in the meantime.

jscn commented 8 years ago

Well, I goofed that up. Still working on a test to reproduce the issue I'm seeing in my application. Might actually be an error on my end after all...

jscn commented 8 years ago

Ugh, my bad, had my MRO confused. Schoolboy error :/