summaryrefslogtreecommitdiff
path: root/django/http/multipartparser.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-11-03 21:43:11 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-11-03 22:07:35 +0100
commitfc10418fba4fb906e4265650b62c510d526d63f7 (patch)
treee00dc8dfa531f03a9ba973e4da80d0f796e83733 /django/http/multipartparser.py
parent973f539ab83bb46645f2f711190735c66a246797 (diff)
downloaddjango-fc10418fba4fb906e4265650b62c510d526d63f7.tar.gz
Fixed #18963 -- Used a subclass-friendly pattern
for Python 2 object model compatibility methods.
Diffstat (limited to 'django/http/multipartparser.py')
-rw-r--r--django/http/multipartparser.py16
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.