1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00

fix valuerror of wrapper in get_save_path

This commit is contained in:
rokfordchez 2020-02-08 22:57:45 +07:00
parent 02acef8ede
commit 804d91f2ad
4 changed files with 50 additions and 28 deletions

View file

@ -3,6 +3,7 @@ import email.header
import logging
import os
from django.utils.deconstruct import deconstructible
from django.conf import settings
logger = logging.getLogger(__name__)
@ -143,16 +144,14 @@ def get_body_from_message(message, maintype, subtype):
return body
def get_save_path(setting):
def _tmp(instance, filename):
settings = get_settings()
def get_save_path(instance, filename, setting):
settings = get_settings()
path = settings[setting]
if '%' in path:
path = datetime.datetime.utcnow().strftime(path)
path = settings[setting]
if '%' in path:
path = datetime.datetime.utcnow().strftime(path)
return os.path.join(
path,
filename,
)
return _tmp
return os.path.join(
path,
filename,
)