def get_old_and_new_values(change_type, message):
 if (change_type in ['subject', 'name', 'estimated_finish', 'estimated_start']):
  old = message['change']['diff'][change_type]['from']
  new = message['change']['diff'][change_type]['to']
  return (old, new)
 try:
  old = message['change']['diff'][change_type]['from']
 except KeyError:
  old = None
 try:
  new = message['change']['diff'][change_type]['to']
 except KeyError:
  new = None
 return (old, new)

def get_old_and_new_values ( change_type , message ) : if ( change_type in [ 'subject' , 'name' , 'estimated_finish' , 'estimated_start' ] ) : old = message [ 'change' ] [ 'diff' ] [ change_type ] [ 'from' ] new = message [ 'change' ] [ 'diff' ] [ change_type ] [ 'to' ] return ( old , new ) try : old = message [ 'change' ] [ 'diff' ] [ change_type ] [ 'from' ] except KeyError : old = None try : new = message [ 'change' ] [ 'diff' ] [ change_type ] [ 'to' ] except KeyError : new = None return ( old , new )
parses the payload and finds previous and current value of change_type .