Пример #1
0
    def get_response(entry):
        """
        Helper function for getting json for each object
        Args:
            entry (Msg): Message object

        Returns:
            dict to convert to json
        """
        try:
            sender = entry.senders[0]
        except IndexError:
            sender = None
        try:
            target = entry.db_receivers_objects.all()[0]
        except IndexError:
            target = None
        from world.msgs.messagehandler import MessageHandler
        ic_date = MessageHandler.get_date_from_header(entry)
        return {
            'id': entry.id,
            'sender': get_fullname(sender) if sender else "",
            'target': get_fullname(target) if target else "",
            'message': entry.db_message,
            'ic_date': ic_date
        }
Пример #2
0
 def messages(self):
     return MessageHandler(self)