diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-11-03 21:43:11 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-11-03 22:08:05 +0100 |
| commit | d7688a010a34033a5cc8eecf7b1460169c0e056e (patch) | |
| tree | ec6e0ffea3410d0c7b743d77d123f5eba1db8a0e /django/http/multipartparser.py | |
| parent | be6522561f01aa2a0b503fb35f35c9fd34c5110f (diff) | |
[1.5.x] Fixed #18963 -- Used a subclass-friendly pattern
for Python 2 object model compatibility methods.
Backport of fc10418 from master.
Diffstat (limited to 'django/http/multipartparser.py')
| -rw-r--r-- | django/http/multipartparser.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py index 5bcc874982..9413a1eabb 100644 --- a/django/http/multipartparser.py +++ b/django/http/multipartparser.py @@ -256,7 +256,7 @@ class MultiPartParser(object): """Cleanup filename from Internet Explorer full paths.""" return filename and filename[filename.rfind("\\")+1:].strip() -class LazyStream(object): +class LazyStream(six.Iterator): """ The LazyStream wrapper allows one to get and "unget" bytes from a stream. @@ -323,8 +323,6 @@ class LazyStream(object): self.position += len(output) return output - next = __next__ # Python 2 compatibility - def close(self): """ Used to invalidate/disable this lazy stream. @@ -369,7 +367,7 @@ class LazyStream(object): " if there is none, report this to the Django developers." ) -class ChunkIter(object): +class ChunkIter(six.Iterator): """ An iterable that will yield chunks of data. Given a file-like object as the constructor, this object will yield chunks of read operations from that @@ -389,12 +387,10 @@ class ChunkIter(object): else: raise StopIteration() - next = __next__ # Python 2 compatibility - def __iter__(self): return self -class InterBoundaryIter(object): +class InterBoundaryIter(six.Iterator): """ A Producer that will iterate over boundaries. """ @@ -411,9 +407,7 @@ class InterBoundaryIter(object): except InputStreamExhausted: raise StopIteration() - next = __next__ # Python 2 compatibility - -class BoundaryIter(object): +class BoundaryIter(six.Iterator): """ A Producer that is sensitive to boundaries. @@ -489,8 +483,6 @@ class BoundaryIter(object): stream.unget(chunk[-rollback:]) return chunk[:-rollback] - next = __next__ # Python 2 compatibility - def _find_boundary(self, data, eof = False): """ Finds a multipart boundary in data. |
