Ejemplo n.º 1
0
 def set_mastodon_content(self, content):
     """
     cleaning content by removing any existing html tag
     :param content:
     :return:
     """
     return limit_content(content, 560)
Ejemplo n.º 2
0
 def set_twitter_content(self, content):
     """
     cleaning content by removing any existing html tag
     :param content:
     :return:
     """
     return limit_content(content, 280)
Ejemplo n.º 3
0
 def set_mastodon_content(self, content):
     """
     cleaning content by removing any existing html tag
     :param content:
     :return:
     """
     return limit_content(content, 560)
Ejemplo n.º 4
0
 def set_twitter_content(self, content):
     """
     cleaning content by removing any existing html tag
     :param content:
     :return:
     """
     return limit_content(content, 280)
Ejemplo n.º 5
0
    def save_data(self, trigger_id, **data):
        """
            let's save the data
            don't want to handle empty title nor content
            otherwise this will produce an Exception by
            the Evernote's API

            :param trigger_id: trigger ID from which to save data
            :param data: the data to check to be used and save
            :type trigger_id: int
            :type data:  dict
            :return: the status of the save statement
            :rtype: boolean
        """
        # set the title and content of the data
        title, content = super(ServiceEvernote,
                               self).save_data(trigger_id, **data)
        # get the evernote data of this trigger
        trigger = Evernote.objects.get(trigger_id=trigger_id)
        # initialize notestore process
        note_store = self._notestore(trigger_id, data)
        if isinstance(note_store, evernote.api.client.Store):
            # note object
            note = self._notebook(trigger, note_store)
            # its attributes
            note = self._attributes(note, data)
            # its footer
            content = self._footer(trigger, data, content)
            # its title
            note.title = limit_content(title, 255)
            # its content
            note = self._content(note, content)
            # create a note
            return EvernoteMgr.create_note(note_store, note, trigger_id, data)
        else:
            # so its note an evernote object, so something wrong happens
            return note_store
Ejemplo n.º 6
0
    def save_data(self, trigger_id, **data):
        """
            let's save the data
            don't want to handle empty title nor content
            otherwise this will produce an Exception by
            the Evernote's API

            :param trigger_id: trigger ID from which to save data
            :param data: the data to check to be used and save
            :type trigger_id: int
            :type data:  dict
            :return: the status of the save statement
            :rtype: boolean
        """
        # set the title and content of the data
        title, content = super(ServiceEvernote, self).save_data(trigger_id, **data)
        # get the evernote data of this trigger
        trigger = Evernote.objects.get(trigger_id=trigger_id)
        # initialize notestore process
        note_store = self._notestore(trigger_id, data)
        if isinstance(note_store, evernote.api.client.Store):
            # note object
            note = self._notebook(trigger, note_store)
            # its attributes
            note = self._attributes(note, data)
            # its footer
            content = self._footer(trigger, data, content)
            # its title
            note.title = limit_content(title, 255)
            # its content
            note = self._content(note, content)
            # create a note
            return EvernoteMgr.create_note(note_store, note, trigger_id, data)
        else:
            # so its note an evernote object, so something wrong happens
            return note_store