Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.support.werkzeug.utils.FileWrapper Class Reference

List of all members.

Public Member Functions

def __init__
def close
def __iter__
def next

Public Attributes

 file
 buffer_size

Detailed Description

This class can be used to convert a :class:`file`-like object into
an iterable.  It yields `buffer_size` blocks until the file is fully
read.

You should not use this class directly but rather use the
:func:`wrap_file` function that uses the WSGI server's file wrapper
support if it's available.

.. versionadded:: 0.5

:param file: a :class:`file`-like object with a :meth:`~file.read` method.
:param buffer_size: number of bytes for one iteration.

Definition at line 357 of file utils.py.


Constructor & Destructor Documentation

def MoinMoin.support.werkzeug.utils.FileWrapper.__init__ (   self,
  file,
  buffer_size = 8192 
)

Definition at line 372 of file utils.py.

00372 
00373     def __init__(self, file, buffer_size=8192):
00374         self.file = file
00375         self.buffer_size = buffer_size


Member Function Documentation

Definition at line 380 of file utils.py.

00380 
00381     def __iter__(self):
00382         return self

Definition at line 376 of file utils.py.

00376 
00377     def close(self):
00378         if hasattr(self.file, 'close'):
00379             self.file.close()

Here is the caller graph for this function:

Definition at line 383 of file utils.py.

00383 
00384     def next(self):
00385         data = self.file.read(self.buffer_size)
00386         if data:
00387             return data
00388         raise StopIteration()
00389 
00390 

Here is the caller graph for this function:


Member Data Documentation

Definition at line 374 of file utils.py.

Definition at line 373 of file utils.py.


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