diff --git a/editpost.py b/editpost.py index b3e7d5c..7bec256 100644 --- a/editpost.py +++ b/editpost.py @@ -29,11 +29,15 @@ Content: {posts.posts[post_to_edit_index]['content']} answer = input() if answer == "0" or answer == "T": # Editing the title - posts.posts[post_to_edit_index]['title'] = click.edit(posts.posts[post_to_edit_index]['title']) + title = click.edit(posts.posts[post_to_edit_index]['title']) + title = title.replace("'", "\'") + posts.posts[post_to_edit_index]['title'] = title posts.posts[post_to_edit_index]['editdate'] = datetime.now().strftime("%d%m%YZ%H%M%ST") elif answer == "1" or answer == "C": # Editing the content - posts.posts[post_to_edit_index]['content'] = click.edit(posts.posts[post_to_edit_index]['content']) + content = click.edit(posts.posts[post_to_edit_index]['content']) + content = content.replace("'", "\'") + posts.posts[post_to_edit_index]['content'] = content posts.posts[post_to_edit_index]['editdate'] = datetime.now().strftime("%d%m%YZ%H%M%ST") elif answer == "2" or answer == "D": # Editing the existence diff --git a/newpost.py b/newpost.py index 8abbb7c..da84268 100644 --- a/newpost.py +++ b/newpost.py @@ -18,8 +18,7 @@ import output def newpost(userID, username, datetime): title = input("Title: ") content = click.edit() - content = content.replace("'", "'") - content = content.replace("\n", "\n") + content = content.replace("'", "\'") output.log(content) datetime = datetime.now().strftime("%d%m%YZ%H%M%ST") posts.posts.append({'userID': userID, 'title': title, 'content': content, 'pubdate': datetime, 'editdate': datetime})