def add_post(self, post: Post) -> None: """ 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. """ entry = post.get_entry() encrypted_entry = self.nacl_profile_encrypt(entry) post.set_entry(encrypted_entry) super().add_post(post)
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