From 6f9c4a116668f377b39fdd856950114f34cd0257 Mon Sep 17 00:00:00 2001 From: Adam Coddington Date: Wed, 1 Jun 2016 12:57:48 -0700 Subject: [PATCH] [#99] Fixes a bug that would prevent upload-to path being srtptime'd. --- django_mailbox/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/django_mailbox/utils.py b/django_mailbox/utils.py index bd47e4d..2bec344 100644 --- a/django_mailbox/utils.py +++ b/django_mailbox/utils.py @@ -1,3 +1,4 @@ +import datetime import email.header import logging import os @@ -130,7 +131,11 @@ def get_body_from_message(message, maintype, subtype): def get_attachment_save_path(instance, filename): settings = get_settings() + path = settings['attachment_upload_to'] + if '%' in path: + path = datetime.datetime.utcnow().strftime(path) + return os.path.join( - settings['attachment_upload_to'], + path, filename, )