fix mail processing scripts

This commit is contained in:
Enno Rehling 2017-03-02 08:08:35 +01:00 committed by Enno Rehling
parent b0baba4405
commit bec7a338ab
2 changed files with 7 additions and 2 deletions

View File

@ -360,6 +360,10 @@ def accept(game, locale, stream, extend=None):
return 0 return 0
# the main body of the script: # the main body of the script:
try:
os.mkdir(os.path.join(rootdir, 'log'))
except:
pass # already exists?
LOG_FILENAME=os.path.join(rootdir, 'log/orders.log') LOG_FILENAME=os.path.join(rootdir, 'log/orders.log')
logging.basicConfig(level=logging.DEBUG, filename=LOG_FILENAME) logging.basicConfig(level=logging.DEBUG, filename=LOG_FILENAME)
logger = logging logger = logging

View File

@ -2,6 +2,7 @@
# -*- coding: iso-8859-1 -*- # -*- coding: iso-8859-1 -*-
from os import unlink, symlink, rename, popen, tmpfile from os import unlink, symlink, rename, popen, tmpfile
import sys
import os import os
import os.path import os.path
import ConfigParser import ConfigParser
@ -82,7 +83,7 @@ frommail = 'eressea-server@kn-bremen.de'
gamename = 'Eressea' gamename = 'Eressea'
sender = '%s Server <%s>' % (gamename, frommail) sender = '%s Server <%s>' % (gamename, frommail)
inifile = os.path.join(gamedir, 'eressea.ini') inifile = os.path.join(game_dir, 'eressea.ini')
if not os.path.exists(inifile): if not os.path.exists(inifile):
print "no such file: " . inifile print "no such file: " . inifile
else: else:
@ -202,7 +203,7 @@ for line in lines:
results = check_pwd(infile, email, pw_data) results = check_pwd(infile, email, pw_data)
logfile = open(os.path.join(game_dir, "zug.log"), "a") logfile = open(os.path.join(game_dir, "zug.log"), "a")
dirname, filename = split_filename(infile) dirname, filename = split_filename(infile)
msg = messages["validate-"+locale] + " " + infilename + "\n\n" msg = messages["validate-"+locale] + " " + infile + "\n\n"
for faction, game_email, success, pwd in results: for faction, game_email, success, pwd in results:
msg = msg + messages["faction-"+locale] + " " + faction + "\n" msg = msg + messages["faction-"+locale] + " " + faction + "\n"
if success: failed = False if success: failed = False