Skip to content

Commit 75b0f24

Browse files
Ilya TleukenovIlya Tleukenov
Ilya Tleukenov
authored and
Ilya Tleukenov
committed
fix utils.get_save_path
1 parent 2824cde commit 75b0f24

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

django_mailbox/utils.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from django.conf import settings
77

8-
98
logger = logging.getLogger(__name__)
109

1110

@@ -144,14 +143,16 @@ def get_body_from_message(message, maintype, subtype):
144143
return body
145144

146145

147-
def get_save_path(instance, filename, setting):
148-
settings = get_settings()
146+
def get_save_path(setting):
147+
def _tmp(instance, filename):
148+
settings = get_settings()
149149

150-
path = settings[setting]
151-
if '%' in path:
152-
path = datetime.datetime.utcnow().strftime(path)
150+
path = settings[setting]
151+
if '%' in path:
152+
path = datetime.datetime.utcnow().strftime(path)
153153

154-
return os.path.join(
155-
path,
156-
filename,
157-
)
154+
return os.path.join(
155+
path,
156+
filename,
157+
)
158+
return _tmp

0 commit comments

Comments
 (0)