check the mails dump directory exists

This commit is contained in:
Serghei Mihai 2016-03-29 14:44:18 +02:00
parent adde1b024a
commit a45871b95a
1 changed files with 4 additions and 1 deletions

View File

@ -120,7 +120,10 @@ L'équipe Entrouvert
if __name__ == '__main__':
mail = sys.stdin.read()
filename = '/tmp/%s.mail' % uuid.uuid4()
mail_dumps_dir = '/var/tmp'
if not os.path.exists(mail_dumps_dir):
os.mkdir(mail_dumps_dir)
filename = os.path.join(mail_dumps_dir, '%s.mail' % uuid.uuid4())
with open(filename, 'w') as mail_dump:
mail_dump.write(mail)
create_ticket(mail)