Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Private Attributes
Archetypes.WebDAVSupport.PdataStreamIterator Class Reference

List of all members.

Public Member Functions

def __init__
def __iter__
def next
def __len__

Public Attributes

 file
 size
 streamsize

Static Private Attributes

tuple __implements__ = (IStreamIterator,)

Detailed Description

Definition at line 13 of file WebDAVSupport.py.


Constructor & Destructor Documentation

def Archetypes.WebDAVSupport.PdataStreamIterator.__init__ (   self,
  data,
  size,
  streamsize = 1<<16 
)

Definition at line 17 of file WebDAVSupport.py.

00017 
00018     def __init__(self, data, size, streamsize=1<<16):
00019         # Consume the whole data into a TemporaryFile when
00020         # constructing, otherwise we might end up loading the whole
00021         # file in memory or worse, loading objects after the
00022         # connection is closed.
00023         f = tempfile.TemporaryFile(mode='w+b')
00024 
00025         while data is not None:
00026             f.write(data.data)
00027             data = data.next
00028 
00029         assert size == f.tell(), 'Informed length does not match real length'
00030         f.seek(0)
00031 
00032         self.file = f
00033         self.size = size
00034         self.streamsize = streamsize


Member Function Documentation

Definition at line 35 of file WebDAVSupport.py.

00035 
00036     def __iter__(self):
00037         return self

Here is the caller graph for this function:

Definition at line 45 of file WebDAVSupport.py.

00045 
00046     def __len__(self):
00047         return self.size

Definition at line 38 of file WebDAVSupport.py.

00038 
00039     def next(self):
00040         data = self.file.read(self.streamsize)
00041         if not data:
00042             self.file.close()
00043             raise StopIteration
00044         return data


Member Data Documentation

tuple Archetypes.WebDAVSupport.PdataStreamIterator.__implements__ = (IStreamIterator,) [static, private]

Definition at line 15 of file WebDAVSupport.py.

Definition at line 31 of file WebDAVSupport.py.

Definition at line 32 of file WebDAVSupport.py.

Definition at line 33 of file WebDAVSupport.py.


The documentation for this class was generated from the following file: