Compare commits

..

No commits in common. "40db35cf7f846914634916b5c804c3e8c610f4f2" and "d54da0ac66e5bccf8b636c4a7a2fdddef1868caf" have entirely different histories.

5 changed files with 13 additions and 20 deletions

1
.gitignore vendored
View File

@ -1,5 +1,4 @@
config.py
htmlconfig.py
__pycache__
*.swp
log

View File

@ -1,8 +1,10 @@
import users
import posts
import rebuild
import click
def editpost(userID, datetime, config, posts, users):
def editpost(userID, datetime):
post_counter = 0
user_posts = []
print("Which post do you want to edit?")

View File

@ -1,17 +1,4 @@
import sys # Command line arguments
from importlib.machinery import SourceFileLoader
from datetime import datetime
import newpost
import editpost
import rebuild
import initialise
config_file_path = "config.py"
if len(sys.argv) > 1:
for argument in sys.argv:
if argument[:9] == "--config=":
config_file_path = argument[9:]
try:
import posts
except:
@ -23,13 +10,19 @@ except:
print("No users database")
initialise.initialise()
try:
config = SourceFileLoader("config", config_file_path).load_module()
import config
if config.autogenerated == True:
print("Error: autogenerated = True")
exit()
except:
print("Please move example.config.py to config.py and edit the options to your case and then set autogenerated=False")
exit()
import newpost
import editpost
import rebuild
import sys # Command line arguments
from datetime import datetime
if len(sys.argv) > 1:
for argument in sys.argv:
@ -60,8 +53,8 @@ if user_present == True:
answer = input()
if answer == 'N' or answer == '0':
newpost.newpost(userID, username, datetime, config, posts, users)
newpost.newpost(userID, username, datetime)
if answer == 'E' or answer == '1':
editpost.editpost(userID, datetime, config, posts, users)
editpost.editpost(userID, datetime)
else:
print('Sorry, that account does not exist, If it should, please ask the webadmin to add this account')

View File

@ -15,7 +15,7 @@ except:
print("No users database")
import output
def newpost(userID, username, datetime, config, posts, users):
def newpost(userID, username, datetime):
title = input("Title: ")
content = click.edit()
content = content.replace("'", "\'")

View File

@ -11,7 +11,6 @@ def parse_post_format(post, post_index, username):
post = post.replace("%C", post_data["content"])
post = post.replace("%L", f"{config.site_url}/post/{post_index}.{config.file_extension}")
post = post.replace("%U", f"{config.site_url}/user/{username}.{config.file_extension}")
post = post.replace("%H", f"{config.site_url}/")
post = post.replace("%N", username)
return post