forked from github/server
write accepted orders to database
This commit is contained in:
parent
dbbfc3317e
commit
b20e6972a5
|
@ -57,6 +57,9 @@ sendmail = True
|
||||||
maxfiles = 30
|
maxfiles = 30
|
||||||
# write headers to file?
|
# write headers to file?
|
||||||
writeheaders = True
|
writeheaders = True
|
||||||
|
# write received files to datrabase?
|
||||||
|
tooldir = os.path.join(rootdir, orderbase)
|
||||||
|
writedb = os.path.exists(tooldir)
|
||||||
# reject all html email?
|
# reject all html email?
|
||||||
rejecthtml = True
|
rejecthtml = True
|
||||||
|
|
||||||
|
@ -225,16 +228,20 @@ def write_part(outfile, part):
|
||||||
|
|
||||||
def copy_orders(message, filename, sender):
|
def copy_orders(message, filename, sender):
|
||||||
# print the header first
|
# print the header first
|
||||||
|
dirname, basename = split(filename)
|
||||||
if writeheaders:
|
if writeheaders:
|
||||||
from os.path import split
|
header_dir = dirname + '/headers'
|
||||||
dirname, basename = split(filename)
|
if not os.path.exists(header_dir): os.mkdir(header_dir)
|
||||||
dirname = dirname + '/headers'
|
outfile = open(header_dir + '/' + basename, "w")
|
||||||
if not os.path.exists(dirname): os.mkdir(dirname)
|
|
||||||
outfile = open(dirname + '/' + basename, "w")
|
|
||||||
for name, value in message.items():
|
for name, value in message.items():
|
||||||
outfile.write(name + ": " + value + "\n")
|
outfile.write(name + ": " + value + "\n")
|
||||||
outfile.close()
|
outfile.close()
|
||||||
|
|
||||||
|
if writedb:
|
||||||
|
cli = os.path.join(tooldir, 'cli.php');
|
||||||
|
dbname = os.path.join(dirname, 'orders.db')
|
||||||
|
subprocess.call(['php', cli, '-d', dbname, 'insert', basename])
|
||||||
|
|
||||||
found = False
|
found = False
|
||||||
outfile = open(filename, "w")
|
outfile = open(filename, "w")
|
||||||
if message.is_multipart():
|
if message.is_multipart():
|
||||||
|
|
Loading…
Reference in New Issue