Ticket #9632: chunks.diff

File chunks.diff, 727 bytes (added by Peter Sagerson, 16 years ago)
  • django/core/files/base.py

     
    6868
    6969        if hasattr(self, 'seek'):
    7070            self.seek(0)
    71         # Assume the pointer is at zero...
    72         counter = self.size
     71       
     72        chunk = self.read(chunk_size)
     73        while len(chunk) > 0:
     74            yield chunk
     75            chunk = self.read(chunk_size)
    7376
    74         while counter > 0:
    75             yield self.read(chunk_size)
    76             counter -= chunk_size
    77 
    7877    def multiple_chunks(self, chunk_size=None):
    7978        """
    8079        Returns ``True`` if you can expect multiple chunks.
Back to Top