summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2008-08-18 13:40:25 -0400
committerWill Woods <wwoods@redhat.com>2008-08-18 13:40:25 -0400
commit772bb9f201521535df57fa8b37d2da2af1c3a5fb (patch)
treef34237ded85f6e92723ab405d55ceffc10477db8
parentff1ce61e55ae0b2f5e8fb30d39c77f8bdddfe4fa (diff)
downloadpython-bugzilla-772bb9f201521535df57fa8b37d2da2af1c3a5fb.tar.gz
python-bugzilla-772bb9f201521535df57fa8b37d2da2af1c3a5fb.tar.xz
python-bugzilla-772bb9f201521535df57fa8b37d2da2af1c3a5fb.zip
Fix up _updatecc - change the action param to match other methods and implement it for bz32.
-rw-r--r--bugzilla/base.py6
-rw-r--r--bugzilla/bugzilla3.py18
-rw-r--r--bugzilla/rhbugzilla.py7
3 files changed, 26 insertions, 5 deletions
diff --git a/bugzilla/base.py b/bugzilla/base.py
index 8158998..db9b2e9 100644
--- a/bugzilla/base.py
+++ b/bugzilla/base.py
@@ -479,16 +479,18 @@ class BugzillaBase(object):
def _updatedeps(self,id,blocked,dependson,action):
'''IMPLEMENT ME: update the deps (blocked/dependson) for the given bug.
blocked, dependson: list of bug ids/aliases
- action: 'add' or 'remove'
+ action: 'add' or 'delete'
'''
raise NotImplementedError
def _updatecc(self,id,cclist,action,comment='',nomail=False):
'''IMPLEMENT ME: Update the CC list using the action and account list
specified.
cclist must be a list (not a tuple!) of addresses.
- action may be 'add', 'remove', or 'makeexact'.
+ action may be 'add', 'delete', or 'overwrite'.
comment specifies an optional comment to add to the bug.
if mail is True, email will be generated for this change.
+ Note that using 'overwrite' may result in up to three XMLRPC calls
+ (fetch list, remove each element, add new elements). Avoid if possible.
'''
raise NotImplementedError
def _updatewhiteboard(self,id,text,which,action):
diff --git a/bugzilla/bugzilla3.py b/bugzilla/bugzilla3.py
index 562c975..602c49c 100644
--- a/bugzilla/bugzilla3.py
+++ b/bugzilla/bugzilla3.py
@@ -239,11 +239,25 @@ class RHBugzilla32(Bugzilla32):
def _updatecc(self,id,cclist,action,comment='',nomail=False):
'''Updates the CC list using the action and account list specified.
cclist must be a list (not a tuple!) of addresses.
- action may be 'add', 'remove', or 'makeexact'.
+ action may be 'add', 'delete', or 'overwrite'.
comment specifies an optional comment to add to the bug.
if mail is True, email will be generated for this change.
'''
- raise NotImplementedError, "wwoods needs to port this method."
+ update = {}
+ if comment:
+ update['comment'] = comment
+
+ if action in ('add','delete'):
+ update['%s_cc' % action] = cclist
+ self._update_bug(id,update)
+ elif action == 'overwrite':
+ r = self._getbug(id)
+ if 'cc' not in r:
+ raise AttributeError, "Can't find cc list in bug %s" % str(id)
+ self._updatecc(id,r['cc'],'delete')
+ self._updatecc(id,cclist,'add')
+ else:
+ raise ValueError, "action must be 'add','delete', or 'overwrite'"
def _updatewhiteboard(self,id,text,which,action):
'''Update the whiteboard given by 'which' for the given bug.
diff --git a/bugzilla/rhbugzilla.py b/bugzilla/rhbugzilla.py
index 984787b..a0a5656 100644
--- a/bugzilla/rhbugzilla.py
+++ b/bugzilla/rhbugzilla.py
@@ -211,10 +211,15 @@ class RHBugzilla(bugzilla.base.BugzillaBase):
def _updatecc(self,id,cclist,action,comment='',nomail=False):
'''Updates the CC list using the action and account list specified.
cclist must be a list (not a tuple!) of addresses.
- action may be 'add', 'remove', or 'makeexact'.
+ action may be 'add', 'delete', or 'overwrite'.
comment specifies an optional comment to add to the bug.
if mail is True, email will be generated for this change.
'''
+ # Massage the 'action' param into what the old updateCC call expects
+ if action == 'delete':
+ action = 'remove'
+ elif action == 'overwrite':
+ action = 'makeexact'
data = {'id':id, 'action':action, 'cc':','.join(cclist),
'comment':comment, 'nomail':nomail}
return self._proxy.bugzilla.updateCC(data)