forked from ticketfrei/ticketfrei
Fix more path issues and add aliases file path to config.
This commit is contained in:
parent
768a4350bd
commit
7ef8c3e197
|
@ -4,6 +4,7 @@ import os
|
||||||
ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
|
ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||||
TEMPLATE_DIR = os.path.join(ROOT_DIR, 'template', '')
|
TEMPLATE_DIR = os.path.join(ROOT_DIR, 'template', '')
|
||||||
STATIC_DIR = os.path.join(ROOT_DIR, 'static', '')
|
STATIC_DIR = os.path.join(ROOT_DIR, 'static', '')
|
||||||
|
BOT_DIR = os.path.join(ROOT_DIR, 'bots')
|
||||||
|
|
||||||
def load_env():
|
def load_env():
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -11,6 +11,7 @@ contact = "b3yond@riseup.net"
|
||||||
|
|
||||||
[mail]
|
[mail]
|
||||||
mbox_user = "root"
|
mbox_user = "root"
|
||||||
|
aliases_path = "/etc/aliases"
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
db_path = "/var/ticketfrei/db.sqlite"
|
db_path = "/var/ticketfrei/db.sqlite"
|
||||||
|
|
|
@ -243,7 +243,7 @@ u\d\d?"""
|
||||||
(uid, "bastard"))
|
(uid, "bastard"))
|
||||||
else:
|
else:
|
||||||
uid = json['uid']
|
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")
|
f.write(city + ": " + config["mail"]["mbox_user"] + "\n")
|
||||||
self.execute("INSERT INTO email (user_id, email) VALUES(?, ?);",
|
self.execute("INSERT INTO email (user_id, email) VALUES(?, ?);",
|
||||||
(uid, json['email']))
|
(uid, json['email']))
|
||||||
|
|
|
@ -95,8 +95,8 @@ def city_page(city, info=None):
|
||||||
citydict = db.user_facing_properties(city)
|
citydict = db.user_facing_properties(city)
|
||||||
if citydict is not None:
|
if citydict is not None:
|
||||||
citydict['info'] = info
|
citydict['info'] = info
|
||||||
return bottle.template('template/city.tpl', **citydict)
|
return bottle.template('city.tpl', **citydict)
|
||||||
return bottle.template('template/propaganda.tpl',
|
return bottle.template('propaganda.tpl',
|
||||||
**dict(info='There is no Ticketfrei bot in your city'
|
**dict(info='There is no Ticketfrei bot in your city'
|
||||||
' yet. Create one yourself!'))
|
' yet. Create one yourself!'))
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,12 @@
|
||||||
|
|
||||||
<%
|
<%
|
||||||
# import all the settings templates from bots/*/settings.tpl
|
# import all the settings templates from bots/*/settings.tpl
|
||||||
|
from config import BOT_DIR
|
||||||
import os
|
import os
|
||||||
bots = os.listdir('bots')
|
bots = os.listdir(BOT_DIR)
|
||||||
|
|
||||||
for bot in bots:
|
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
|
end
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue