Fixed #7156 -- Normalise file paths before returning them in models.

This avoids problems with a database that was created on Unix being used on
Windows and giving interesting results. Patch from fcaprioli@alice.it.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7795 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-06-30 07:17:18 +00:00
parent 44ca5f46c9
commit 1a2005dfed
1 changed files with 1 additions and 1 deletions

View File

@ -457,7 +457,7 @@ class Model(object):
def _get_FIELD_filename(self, field):
if getattr(self, field.attname): # value is not blank
return os.path.join(settings.MEDIA_ROOT, getattr(self, field.attname))
return os.path.normpath(os.path.join(settings.MEDIA_ROOT, getattr(self, field.attname)))
return ''
def _get_FIELD_url(self, field):