More tweaks for python 3

This commit is contained in:
Lance Edgar 2018-02-15 12:48:14 -06:00
parent 135e98cde1
commit 5c1008a0df
7 changed files with 33 additions and 19 deletions

View file

@ -286,11 +286,19 @@ class MessagesView(MasterView):
return recipient
def template_kwargs_create(self, **kwargs):
kwargs['available_recipients'] = self.get_available_recipients()
recips = list(self.get_available_recipients().items())
recips.sort(key=self.recipient_sortkey)
kwargs['available_recipients'] = recips
if self.replying:
kwargs['original_message'] = self.get_instance()
return kwargs
def recipient_sortkey(self, recip):
uuid, entry = recip
if isinstance(entry, dict):
return entry['name']
return entry
def get_available_recipients(self):
"""
Return the full mapping of recipients which may be included in a