Skip to content
Snippets Groups Projects
Commit 4c14965f authored by Guido Trotter's avatar Guido Trotter
Browse files

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: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent f9780ccd
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment