예제 #1
0
파일: obj.py 프로젝트: fvennetier/oio-swift
 def app_iter_ranges(self, ranges, content_type,
                     boundary, content_size,
                     *_args, **_kwargs):
     for chunk in multi_range_iterator(
             ranges, content_type, boundary, content_size,
             self._chunked_app_iter_range):
         yield chunk
예제 #2
0
파일: server.py 프로젝트: schatt/swift
 def app_iter_ranges(self, ranges, content_type, boundary, size):
     """Returns an iterator over the data file for a set of ranges"""
     if not ranges:
         yield ""
     else:
         try:
             self.suppress_file_closing = True
             for chunk in multi_range_iterator(ranges, content_type, boundary, size, self.app_iter_range):
                 yield chunk
         finally:
             self.suppress_file_closing = False
             self.close()
예제 #3
0
 def app_iter_ranges(self, ranges, content_type, boundary, size):
     """Returns an iterator over the data file for a set of ranges"""
     if not ranges:
         yield ''
     else:
         try:
             self.suppress_file_closing = True
             for chunk in multi_range_iterator(ranges, content_type,
                                               boundary, size,
                                               self.app_iter_range):
                 yield chunk
         finally:
             self.suppress_file_closing = False
             self.close()
예제 #4
0
 def app_iter_ranges(self, ranges, content_type, boundary, size):
     if not ranges:
         yield ''
     else:
         try:
             self._suppress_file_closing = True
             for chunk in multi_range_iterator(ranges, content_type,
                                               boundary, size,
                                               self.app_iter_range):
                 yield chunk
         finally:
             self._suppress_file_closing = False
             try:
                 self.close()
             except DiskFileQuarantined:
                 pass
예제 #5
0
 def app_iter_ranges(self, ranges, content_type, boundary, size):
     if not ranges:
         yield ''
     else:
         try:
             self._suppress_file_closing = True
             for chunk in multi_range_iterator(
                     ranges, content_type, boundary, size,
                     self.app_iter_range):
                 yield chunk
         finally:
             self._suppress_file_closing = False
             try:
                 self.close()
             except DiskFileQuarantined:
                 pass
예제 #6
0
    def app_iter_ranges(self, ranges, content_type, boundary, content_size):
        """
        This method assumes that iter(self) yields all the data bytes that
        go into the response, but none of the MIME stuff. For example, if
        the response will contain three MIME docs with data "abcd", "efgh",
        and "ijkl", then iter(self) will give out the bytes "abcdefghijkl".

        This method inserts the MIME stuff around the data bytes.
        """
        si = Spliterator(self)
        mri = multi_range_iterator(
            ranges, content_type, boundary, content_size,
            lambda start, end_plus_one: si.take(end_plus_one - start))
        try:
            for x in mri:
                yield x
        finally:
            self.close()
예제 #7
0
    def app_iter_ranges(self, ranges, content_type, boundary, content_size):
        """
        This method assumes that iter(self) yields all the data bytes that
        go into the response, but none of the MIME stuff. For example, if
        the response will contain three MIME docs with data "abcd", "efgh",
        and "ijkl", then iter(self) will give out the bytes "abcdefghijkl".

        This method inserts the MIME stuff around the data bytes.
        """
        si = Spliterator(self)
        mri = multi_range_iterator(
            ranges, content_type, boundary, content_size,
            lambda start, end_plus_one: si.take(end_plus_one - start))
        try:
            for x in mri:
                yield x
        finally:
            self.close()
예제 #8
0
파일: obj.py 프로젝트: AymericDu/swift
 def app_iter_ranges(self, ranges, content_type, boundary, content_size,
                     *_args, **_kwargs):
     for chunk in multi_range_iterator(ranges, content_type, boundary,
                                       content_size,
                                       self._chunked_app_iter_range):
         yield chunk