From 1a2005dfed5234f33c44de0e89b53d042c714d94 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Mon, 30 Jun 2008 07:17:18 +0000 Subject: [PATCH] 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 --- django/db/models/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/db/models/base.py b/django/db/models/base.py index 70420300e4..659c67c0d3 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -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):