Code

Ticket #10347: file-descriptor-error.patch

File file-descriptor-error.patch, 777 bytes (added by dc, 5 years ago)
  • db/models/fields/files.py

    diff -uprN django.orig/db/models/fields/files.py django/db/models/fields/files.py
    old new class FileDescriptor(object): 
    115115 
    116116    def __get__(self, instance=None, owner=None): 
    117117        if instance is None: 
    118             raise AttributeError, "%s can only be accessed from %s instances." % (self.field.name(self.owner.__name__)) 
     118            raise AttributeError('%s can only be accessed from %s instances.' % (self.field.name, owner.__name__)) 
    119119        file = instance.__dict__[self.field.name] 
    120120        if not isinstance(file, FieldFile): 
    121121            # Create a new instance of FieldFile, based on a given file name