- msg_list.append(msg_tuple)
-
- if msg_list == []:
- response = 'Hi {}: {}'.format(sender, 'I found no open MRs for you.')
- else:
- # sort by the creation time
- sorted_msg_list = sorted(msg_list, key=lambda x: x[0])
-
- # extract the msgs from the tuple list
- msgs = [x[1] for x in sorted_msg_list]
-
- # join those msgs together.
- msg = "\n".join(msgs)
- response = 'Hi {}: These MRs need some attention:\n{}'.format(sender, msg)