示例#1
0
    def to_integration_message(self, lang):
        message = IntegrationSpotMessage()

        display_name = ""
        description = ""

        found_lang = False
        for l_info in self.localized_information.values():
            if l_info.language == lang:
                display_name = l_info.display_name
                description = l_info.description
                found_lang = True

        if found_lang == False: #requested lang not found
            l_info = self.localized_information.values()[0]
            display_name = l_info.display_name
            description = l_info.description

        message.display_name = display_name
        message.description = description
        
        message.location=location_message_from_geopoint(self.location)

        message.image = file_dir + self.image

        return message
示例#2
0
    def to_enduser_message(self, lang, system, include_content=False):
        message = EnduserSpotMessage()
        
        display_name = ""
        description = ""

        found_lang = False
        for l_info in self.localized_information.values():
            if l_info.language == lang:
                display_name = l_info.display_name
                description = l_info.description
                found_lang = True

        if found_lang == False: #requested lang not found
            l_info = self.localized_information.values()[0]
            display_name = l_info.display_name
            description = l_info.description

        message.display_name = display_name
        message.description = description

        message.location=location_message_from_geopoint(self.location)

        message.image = file_dir + self.image

        if include_content:
            message.content_id = self.content
            
        message.category = self.category

        return message