summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2007-09-18 12:28:36 -0400
committerWill Woods <wwoods@redhat.com>2007-09-18 12:28:36 -0400
commitf72bac580591119d1f72dc68e87fccc5278730f0 (patch)
tree1c92554d93f31fc534a1ef6f80b9002bb3d85f3e
parent4aae6fb8f6abb6539bada70ea18d83601c267ec3 (diff)
downloadpython-bugzilla-f72bac580591119d1f72dc68e87fccc5278730f0.tar.gz
python-bugzilla-f72bac580591119d1f72dc68e87fccc5278730f0.tar.xz
python-bugzilla-f72bac580591119d1f72dc68e87fccc5278730f0.zip
make createbug return a Bug object. Add yet more comments.
-rw-r--r--bugzilla.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/bugzilla.py b/bugzilla.py
index 0ce28e3..c1de8c8 100644
--- a/bugzilla.py
+++ b/bugzilla.py
@@ -461,7 +461,8 @@ class Bugzilla(object):
def _createbug(self,**data):
'''Raw xmlrpc call for createBug() Doesn't bother guessing defaults
- or checking argument validity. Use with care.'''
+ or checking argument validity. Use with care.
+ Returns [bug_id, mailresults]'''
return self._proxy.bugzilla.createBug(data,self.username,self.password)
def createbug(self,check_args=False,**data):
@@ -538,13 +539,21 @@ class Bugzilla(object):
# network roundtrip if your op_sys or rep_platform is bad, but at the
# expense of getting querydefaults, which is.. an added network
# roundtrip. Basically it's only useful if you're mucking around with
- # createbug() in ipython.
+ # createbug() in ipython and you've already loaded querydefaults.
if check_args:
if data['op_sys'] not in self.querydefaults['op_sys_list']:
raise ValueError, "invalid value for op_sys: %s" % data['op_sys']
if data['rep_platform'] not in self.querydefaults['rep_platform_list']:
raise ValueError, "invalid value for rep_platform: %s" % data['rep_platform']
- return self._createbug(**data)
+ # Actually perform the createbug call.
+ # We return a nearly-empty Bug object, which is kind of a bummer 'cuz
+ # it'll take another network roundtrip to fill it. We *could* fake it
+ # and fill in the blanks with the data given to this method, but the
+ # server might modify/add/drop stuff. Then we'd have a Bug object that
+ # lied about the actual contents of the database. That would be bad.
+ [bug_id, mail_results] = self._createbug(**data)
+ return Bug(self,bug_id=bug_id)
+ # Trivia: this method has ~5.8 lines of comment per line of code. Yow!
class CookieTransport(xmlrpclib.Transport):
'''A subclass of xmlrpclib.Transport that supports cookies.'''