Correctly store apostrophies in the posts.py storage
This commit is contained in:
parent
ff79fdd2a7
commit
aa3ae147bf
@ -29,11 +29,15 @@ Content: {posts.posts[post_to_edit_index]['content']}
|
|||||||
answer = input()
|
answer = input()
|
||||||
|
|
||||||
if answer == "0" or answer == "T": # Editing the title
|
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")
|
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
|
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")
|
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
|
elif answer == "2" or answer == "D": # Editing the existence
|
||||||
|
@ -18,8 +18,7 @@ import output
|
|||||||
def newpost(userID, username, datetime):
|
def newpost(userID, username, datetime):
|
||||||
title = input("Title: ")
|
title = input("Title: ")
|
||||||
content = click.edit()
|
content = click.edit()
|
||||||
content = content.replace("'", "'")
|
content = content.replace("'", "\'")
|
||||||
content = content.replace("\n", "\n")
|
|
||||||
output.log(content)
|
output.log(content)
|
||||||
datetime = datetime.now().strftime("%d%m%YZ%H%M%ST")
|
datetime = datetime.now().strftime("%d%m%YZ%H%M%ST")
|
||||||
posts.posts.append({'userID': userID, 'title': title, 'content': content, 'pubdate': datetime, 'editdate': datetime})
|
posts.posts.append({'userID': userID, 'title': title, 'content': content, 'pubdate': datetime, 'editdate': datetime})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user