Skip to content
  • Guido Trotter's avatar
    ConfigObject.ToDict() only export non-None values · 4c14965f
    Guido Trotter authored
    
    
    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>
    4c14965f