Exemplo n.º 1
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
Exemplo n.º 2
0
 def add_post_process(self):
     """
     Adds the text currently in the entry_editor widget to the active DSU file.
     :return:
     """
     from a5 import posts_transclude
     if self._profile_filename is None:
         self.footer.set_status('Create/Open a DSU file first!',
                                color='red',
                                change_back=True)
     else:
         post = Post()
         title = 'TYPE TITLE HERE'
         entry = 'TYPE ENTRY HERE'
         post.set_entry(entry)
         post.set_title(title)
         self._current_profile.add_post(post)
         self._current_profile = posts_transclude(self._current_profile)
         self._current_profile.save_profile(self._profile_filename)
         self.body.set_posts(self._current_profile.get_posts())
         self.body.set_text_entry("")
         self.footer.set_status('Post added!', 'green', change_back=True)