Ticket #9344: 9344-temporary-file-delegation.patch

File 9344-temporary-file-delegation.patch, 817 bytes (added by Armin Ronacher, 11 years ago)

delegates attribute lookups to the underlaying file.

  • django/core/files/temp.py

     
    4848        def __del__(self):
    4949            self.close()
    5050
    51         def read(self, *args):          return self.file.read(*args)
    52         def seek(self, offset):         return self.file.seek(offset)
    53         def write(self, s):             return self.file.write(s)
    54         def __iter__(self):             return iter(self.file)
    55         def readlines(self, size=None): return self.file.readlines(size)
    56         def xreadlines(self):           return self.file.xreadlines()
     51        def __getattr__(self, name):
     52            return getattr(self.file, name)
    5753
    5854    NamedTemporaryFile = TemporaryFile
    5955else:
Back to Top