Compare commits
2 Commits
d54da0ac66
...
40db35cf7f
Author | SHA1 | Date | |
---|---|---|---|
40db35cf7f | |||
66efd0c696 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
config.py
|
||||
htmlconfig.py
|
||||
__pycache__
|
||||
*.swp
|
||||
log
|
||||
|
@ -1,10 +1,8 @@
|
||||
import users
|
||||
import posts
|
||||
import rebuild
|
||||
|
||||
import click
|
||||
|
||||
def editpost(userID, datetime):
|
||||
def editpost(userID, datetime, config, posts, users):
|
||||
post_counter = 0
|
||||
user_posts = []
|
||||
print("Which post do you want to edit?")
|
||||
|
25
glogger.py
25
glogger.py
@ -1,4 +1,17 @@
|
||||
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:
|
||||
@ -10,19 +23,13 @@ except:
|
||||
print("No users database")
|
||||
initialise.initialise()
|
||||
try:
|
||||
import config
|
||||
config = SourceFileLoader("config", config_file_path).load_module()
|
||||
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:
|
||||
@ -53,8 +60,8 @@ if user_present == True:
|
||||
|
||||
answer = input()
|
||||
if answer == 'N' or answer == '0':
|
||||
newpost.newpost(userID, username, datetime)
|
||||
newpost.newpost(userID, username, datetime, config, posts, users)
|
||||
if answer == 'E' or answer == '1':
|
||||
editpost.editpost(userID, datetime)
|
||||
editpost.editpost(userID, datetime, config, posts, users)
|
||||
else:
|
||||
print('Sorry, that account does not exist, If it should, please ask the webadmin to add this account')
|
||||
|
@ -15,7 +15,7 @@ except:
|
||||
print("No users database")
|
||||
import output
|
||||
|
||||
def newpost(userID, username, datetime):
|
||||
def newpost(userID, username, datetime, config, posts, users):
|
||||
title = input("Title: ")
|
||||
content = click.edit()
|
||||
content = content.replace("'", "\'")
|
||||
|
@ -11,6 +11,7 @@ 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user