Django

Code

Show
Ignore:
Timestamp:
06/22/07 11:56:04 (2 years ago)
Author:
bouldersprinters
Message:

boulder-oracle-sprint: Merged to [5511]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/boulder-oracle-sprint/django/http/__init__.py

    r5491 r5512  
    223223        if isinstance(content, unicode): 
    224224            content = content.encode(self._charset) 
    225  
    226         # If self._container was an iterator, we have just exhausted it, so we 
    227         # need to save the results for anything else that needs access 
    228         if not self._is_string: 
    229             self._container = [content] 
    230             self._is_string = True 
    231225        return content 
    232226 
     
    238232 
    239233    def __iter__(self): 
    240         for chunk in self._container: 
    241             if isinstance(chunk, unicode): 
    242                 chunk = chunk.encode(self._charset) 
    243             yield chunk 
     234        self._iterator = self._container.__iter__() 
     235        return self 
     236 
     237    def next(self): 
     238        chunk = self._iterator.next() 
     239        if isinstance(chunk, unicode): 
     240            chunk = chunk.encode(self._charset) 
     241        return chunk 
    244242 
    245243    def close(self):