Fix more path issues and add aliases file path to config.

This commit is contained in:
cookietime--yay 2019-03-06 19:40:02 +01:00
parent 768a4350bd
commit 7ef8c3e197
5 changed files with 8 additions and 5 deletions

View file

@ -4,6 +4,7 @@ import os
ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
TEMPLATE_DIR = os.path.join(ROOT_DIR, 'template', '')
STATIC_DIR = os.path.join(ROOT_DIR, 'static', '')
BOT_DIR = os.path.join(ROOT_DIR, 'bots')
def load_env():
"""

View file

@ -11,6 +11,7 @@ contact = "b3yond@riseup.net"
[mail]
mbox_user = "root"
aliases_path = "/etc/aliases"
[database]
db_path = "/var/ticketfrei/db.sqlite"

View file

@ -243,7 +243,7 @@ u\d\d?"""
(uid, "bastard"))
else:
uid = json['uid']
with open("/etc/aliases", "a+") as f:
with open(config['mail']['aliases_path'], "a+") as f:
f.write(city + ": " + config["mail"]["mbox_user"] + "\n")
self.execute("INSERT INTO email (user_id, email) VALUES(?, ?);",
(uid, json['email']))

View file

@ -95,8 +95,8 @@ def city_page(city, info=None):
citydict = db.user_facing_properties(city)
if citydict is not None:
citydict['info'] = info
return bottle.template('template/city.tpl', **citydict)
return bottle.template('template/propaganda.tpl',
return bottle.template('city.tpl', **citydict)
return bottle.template('propaganda.tpl',
**dict(info='There is no Ticketfrei bot in your city'
' yet. Create one yourself!'))

View file

@ -9,11 +9,12 @@
<%
# import all the settings templates from bots/*/settings.tpl
from config import BOT_DIR
import os
bots = os.listdir('bots')
bots = os.listdir(BOT_DIR)
for bot in bots:
include('bots/' + bot + '/settings.tpl', csrf=csrf, city=city)
include(os.path.join(BOT_DIR, bot, 'settings.tpl'), csrf=csrf, city=city)
end
%>