"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "share/roundup/templates/classic/detectors/nosyreaction.py" between
roundup-1.6.1.tar.gz and roundup-2.0.0.tar.gz

About: Roundup is an highly customisable issue-tracking system with command-line, web and e-mail interfaces (written in Python).

nosyreaction.py  (roundup-1.6.1):nosyreaction.py  (roundup-2.0.0)
skipping to change at line 51 skipping to change at line 51
raise roundupdb.DetectorError(message) raise roundupdb.DetectorError(message)
def determineNewMessages(cl, nodeid, oldvalues): def determineNewMessages(cl, nodeid, oldvalues):
''' Figure a list of the messages that are being added to the given ''' Figure a list of the messages that are being added to the given
node in this transaction. node in this transaction.
''' '''
messages = [] messages = []
if oldvalues is None: if oldvalues is None:
# the action was a create, so use all the messages in the create # the action was a create, so use all the messages in the create
messages = cl.get(nodeid, 'messages') messages = cl.get(nodeid, 'messages')
elif oldvalues.has_key('messages'): elif 'messages' in oldvalues:
# the action was a set (so adding new messages to an existing issue) # the action was a set (so adding new messages to an existing issue)
m = {} m = {}
for msgid in oldvalues['messages']: for msgid in oldvalues['messages']:
m[msgid] = 1 m[msgid] = 1
messages = [] messages = []
# figure which of the messages now on the issue weren't there before # figure which of the messages now on the issue weren't there before
for msgid in cl.get(nodeid, 'messages'): for msgid in cl.get(nodeid, 'messages'):
if not m.has_key(msgid): if msgid not in m:
messages.append(msgid) messages.append(msgid)
return messages return messages
def updatenosy(db, cl, nodeid, newvalues): def updatenosy(db, cl, nodeid, newvalues):
'''Update the nosy list for changes to the assignedto '''Update the nosy list for changes to the assignedto
''' '''
# nodeid will be None if this is a new node # nodeid will be None if this is a new node
current_nosy = set() current_nosy = set()
if nodeid is None: if nodeid is None:
ok = ('new', 'yes') ok = ('new', 'yes')
else: else:
ok = ('yes',) ok = ('yes',)
# old node, get the current values from the node if they haven't # old node, get the current values from the node if they haven't
# changed # changed
if not newvalues.has_key('nosy'): if 'nosy' not in newvalues:
nosy = cl.get(nodeid, 'nosy') nosy = cl.get(nodeid, 'nosy')
for value in nosy: for value in nosy:
current_nosy.add(value) current_nosy.add(value)
# if the nosy list changed in this transaction, init from the new value # if the nosy list changed in this transaction, init from the new value
if newvalues.has_key('nosy'): if 'nosy' in newvalues:
nosy = newvalues.get('nosy', []) nosy = newvalues.get('nosy', [])
for value in nosy: for value in nosy:
if not db.hasnode('user', value): if not db.hasnode('user', value):
continue continue
current_nosy.add(value) current_nosy.add(value)
new_nosy = set(current_nosy) new_nosy = set(current_nosy)
# add assignedto(s) to the nosy list # add assignedto(s) to the nosy list
if newvalues.has_key('assignedto') and newvalues['assignedto'] is not None: if 'assignedto' in newvalues and newvalues['assignedto'] is not None:
propdef = cl.getprops() propdef = cl.getprops()
if isinstance(propdef['assignedto'], hyperdb.Link): if isinstance(propdef['assignedto'], hyperdb.Link):
assignedto_ids = [newvalues['assignedto']] assignedto_ids = [newvalues['assignedto']]
elif isinstance(propdef['assignedto'], hyperdb.Multilink): elif isinstance(propdef['assignedto'], hyperdb.Multilink):
assignedto_ids = newvalues['assignedto'] assignedto_ids = newvalues['assignedto']
for assignedto_id in assignedto_ids: for assignedto_id in assignedto_ids:
new_nosy.add(assignedto_id) new_nosy.add(assignedto_id)
# see if there's any new messages - if so, possibly add the author and # see if there's any new messages - if so, possibly add the author and
# recipient to the nosy # recipient to the nosy
if newvalues.has_key('messages'): if 'messages' in newvalues:
if nodeid is None: if nodeid is None:
ok = ('new', 'yes') ok = ('new', 'yes')
messages = newvalues['messages'] messages = newvalues['messages']
else: else:
ok = ('yes',) ok = ('yes',)
# figure which of the messages now on the issue weren't # figure which of the messages now on the issue weren't
oldmessages = cl.get(nodeid, 'messages') oldmessages = cl.get(nodeid, 'messages')
messages = [] messages = []
for msgid in newvalues['messages']: for msgid in newvalues['messages']:
if msgid not in oldmessages: if msgid not in oldmessages:
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)