forked from github/server
write to database after the file is created and dated
This commit is contained in:
parent
305098c32c
commit
32da0028c1
1 changed files with 7 additions and 7 deletions
|
@ -235,13 +235,6 @@ def copy_orders(message, filename, sender, mtime):
|
|||
outfile.write(name + ": " + value + "\n")
|
||||
outfile.close()
|
||||
|
||||
if writedb:
|
||||
dirname, basename = os.path.split(filename)
|
||||
cli = os.path.join(tooldir, 'cli.php');
|
||||
dbname = os.path.join(dirname, 'orders.db')
|
||||
datestr = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(mtime))
|
||||
subprocess.call(['php', cli, '-d', dbname, 'insert', basename, sender, datestr])
|
||||
|
||||
found = False
|
||||
outfile = open(filename, "w")
|
||||
if message.is_multipart():
|
||||
|
@ -262,6 +255,7 @@ def copy_orders(message, filename, sender, mtime):
|
|||
charset = message.get_content_charset()
|
||||
logger.error("could not write text/plain message (charset=%s) for %s" % (charset, sender))
|
||||
outfile.close()
|
||||
|
||||
return found
|
||||
|
||||
# create a file, containing:
|
||||
|
@ -312,6 +306,12 @@ def accept(game, locale, stream, extend=None):
|
|||
warning = " (" + messages["warning-" + locale] + ")"
|
||||
msg = msg + formatpar(messages["nodate-" + locale], 76, 2) + "\n"
|
||||
|
||||
if writedb:
|
||||
dirname, basename = os.path.split(filename)
|
||||
cli = os.path.join(tooldir, 'cli.php');
|
||||
dbname = os.path.join(dirname, 'orders.db')
|
||||
subprocess.call(['php', cli, '-d', dbname, 'insert', basename, email])
|
||||
|
||||
if not text_ok:
|
||||
warning = " (" + messages["error-" + locale] + ")"
|
||||
msg = msg + formatpar(messages["multipart-" + locale], 76, 2) + "\n"
|
||||
|
|
Loading…
Reference in a new issue