Exemplo n.º 1
0
    def _insert_post_tree(self, id, post: Post):
        # entry = post.get_entry()
        title = post.get_title()
        # Since we don't have a title, we will use the first 24 characters of a
        # post entry as the identifier in the post_tree widget.
        if len(title) > 25:
            title = title[:24] + "..."

        self.posts_tree.insert('', id, id, text=title)
Exemplo n.º 2
0
    def add_post(self, post: Post) -> Post:
        """
        Before a post is added to the profile, it should be encrypted. Remember to take advantage of the
        code that is already written in the parent class.

        :return the post after encryption
        """
        entry = post.get_entry()
        encrypted_entry = self.nacl_profile_encrypt(entry)
        post.set_entry(encrypted_entry)

        title = post.get_title()
        encrypted_title = self.nacl_profile_encrypt(title)
        post.set_title(encrypted_title)

        super().add_post(post)
        return post