changeset 12:d8db9b733a12

added superclass constructor for BugzillaObject
author Atul Varma <avarma@mozilla.com>
date Tue, 13 Apr 2010 17:37:33 -0700
parents 29efa19d959a
children d5f43c3aeb29
files bugzilla.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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']]