ConfigObject.ToDict() only export non-None values
The method is changed to a normal loop, to avoid calling getattr() twice. Also __getstate__ is changed to just use ToDict() by default. This should also make __getstate__ work for objects which have to override the ToDict function because they contain other objects. __setstate__ is probably still broken in this case, but so it was before, and it's not used inside our code, so I'll pretend not to have noticed, as there is no "nice" way to fix it, without overriding it all over the place :( Some unittests are added as a bonus, to make sure we behave well. Signed-off-by:Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
Loading
Please register or sign in to comment