# HG changeset patch # User Atul Varma # Date 1271205453 25200 # Node ID d8db9b733a1257000b71904f38ebd6187c0be192 # Parent 29efa19d959ad04389ee7a4a6d0974bdecc817db added superclass constructor for BugzillaObject diff -r 29efa19d959a -r d8db9b733a12 bugzilla.py --- a/bugzilla.py Tue Apr 13 17:27:23 2010 -0700 +++ b/bugzilla.py Tue Apr 13 17:37:33 2010 -0700 @@ -224,6 +224,10 @@ class BugzillaObject(object): __bzprops__ = {} + def __init__(self, jsonobj, bzapi): + self._set_bzprops(jsonobj) + self.bzapi = bzapi + def _set_bzprops(self, jsonobj): for name, proptype in self.__bzprops__.items(): if proptype == bool: @@ -269,10 +273,9 @@ } def __init__(self, jsonobj, bzapi=None): - self.bzapi = bzapi + BugzillaObject.__init__(self, jsonobj, bzapi) self.__email = jsonobj.get('email') self.__real_name = jsonobj.get('real_name') - self._set_bzprops(jsonobj) def __fulfill(self): response = self.bzapi.request('GET', '/user', @@ -324,8 +327,7 @@ } def __init__(self, jsonobj, bzapi=None, bug=None): - self._set_bzprops(jsonobj) - self.bzapi = bzapi + BugzillaObject.__init__(self, jsonobj, bzapi) if 'data' in jsonobj: self.__data = self.__decode_data(jsonobj) else: @@ -396,7 +398,7 @@ } def __init__(self, jsonobj, bzapi=None): - self._set_bzprops(jsonobj) + BugzillaObject.__init__(self, jsonobj, bzapi) self.attachments = [Attachment(attach, bzapi, self) for attach in jsonobj['attachments']]