Author: mtredinnick
Date: 2007-07-06 05:21:14 -0500 (Fri, 06 Jul 2007)
New Revision: 5625

Modified:
   django/trunk/django/db/models/fields/__init__.py
Log:
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
[EMAIL PROTECTED]


Modified: django/trunk/django/db/models/fields/__init__.py
===================================================================
--- django/trunk/django/db/models/fields/__init__.py    2007-07-06 08:35:25 UTC 
(rev 5624)
+++ django/trunk/django/db/models/fields/__init__.py    2007-07-06 10:21:14 UTC 
(rev 5625)
@@ -9,7 +9,7 @@
 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 @@
                 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


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to