From b39bf4bbababf6bc4b70e4754b7f0597b8510b5b Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Wed, 24 Mar 2010 15:42:39 +0000 Subject: [PATCH] SerializableConfigParser: Make Loads class indep Currently SerializableConfigParser.Loads is a static method that returns a SerializableConfigParser. With this patch we change it to a class method that returns a member of the class. This way a subclass calling Loads on itself will get its own member, rather than a bare SerializableConfigParser. Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Balazs Lecz <leczb@google.com> --- lib/objects.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/objects.py b/lib/objects.py index b2d86727f..5ee6ddfec 100644 --- a/lib/objects.py +++ b/lib/objects.py @@ -1034,10 +1034,10 @@ class SerializableConfigParser(ConfigParser.SafeConfigParser): self.write(buf) return buf.getvalue() - @staticmethod - def Loads(data): + @classmethod + def Loads(cls, data): """Load data from a string.""" buf = StringIO(data) - cfp = SerializableConfigParser() + cfp = cls() cfp.readfp(buf) return cfp -- GitLab