diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-07-06 10:21:14 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-07-06 10:21:14 +0000 |
| commit | 3198b645169714af33af651b7d13c3f26a62c103 (patch) | |
| tree | 76fb1e27cd9245d4ddb9bd775e2aecb452a40dd4 | |
| parent | d91fb7079b8d5fa6b5f03982e2ae12b63ed5c8b5 (diff) | |
Fixed #4776 -- Fixed a problem with handling of upload_to attributes. The new
solution still works with non-ASCII filenames. Based on a patch from
mike.j.thompson@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5625 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/db/models/fields/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 7ef532eab6..bc6d551a4c 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -9,7 +9,7 @@ from django.utils.functional import curry from django.utils.itercompat import tee from django.utils.text import capfirst from django.utils.translation import ugettext_lazy, ugettext as _ -from django.utils.encoding import smart_unicode +from django.utils.encoding import smart_unicode, force_unicode, smart_str import datetime, os, time try: import decimal @@ -735,7 +735,7 @@ class FileField(Field): func(new_data[upload_field_name]["filename"], new_data[upload_field_name]["content"], save) def get_directory_name(self): - return os.path.normpath(datetime.datetime.now().strftime(self.upload_to)) + return os.path.normpath(force_unicode(datetime.datetime.now().strftime(smart_str(self.upload_to)))) def get_filename(self, filename): from django.utils.text import get_valid_filename |
