Ticket #8149: UploadedFile-r8226.diff

File UploadedFile-r8226.diff, 711 bytes (added by Tai Lee, 16 years ago)

Updated for r8654 and fixed regular expression to not match empty strings.

  • django/core/files/base.py

     
    11import os
     2import re
    23
    34from django.utils.encoding import smart_str, smart_unicode
    45
     
    9798        # Iterate over this file-like object by newlines
    9899        buffer_ = None
    99100        for chunk in self.chunks():
    100             chunk_buffer = StringIO(chunk)
    101 
    102             for line in chunk_buffer:
     101            for line in re.findall(r'[^\r\n]+(?:\r\n|\r|\n)?|(?:\r\n|\r|\n)', chunk):
    103102                if buffer_:
    104103                    line = buffer_ + line
    105104                    buffer_ = None
Back to Top