Fixed #10347 -- Fixed incorrect AttributeError raised when attempting to access a FileField without an instance. Thanks for the report and patch dc.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9902 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Karen Tracey 2009-02-24 17:24:08 +00:00
parent 7d03ca9e86
commit 5f9ac28856
2 changed files with 7 additions and 1 deletions

View file

@ -122,7 +122,7 @@ class FileDescriptor(object):
def __get__(self, instance=None, owner=None):
if instance is None:
raise AttributeError, "%s can only be accessed from %s instances." % (self.field.name(self.owner.__name__))
raise AttributeError("The '%s' attribute can only be accessed from %s instances." % (self.field.name, owner.__name__))
file = instance.__dict__[self.field.name]
if isinstance(file, basestring) or file is None:
# Create a new instance of FieldFile, based on a given file name