gridfs::grid_file::GridOut Class Reference

List of all members.

Public Member Functions

def __getattr__
def __init__
def __iter__
def read
def readline
def seek
def tell

Static Public Attributes

tuple aliases
tuple chunk_size
tuple content_type
tuple length
tuple md5
tuple metadata
tuple name = _create_property("filename", "Name of this file.", True)
tuple upload_date

Private Attributes

 __buffer
 __chunks
 __position
 _file

Static Private Attributes

tuple _id = _create_property("_id", "The ``'_id'`` value for this file.", True)

Detailed Description

Class to read data out of GridFS.

Definition at line 309 of file grid_file.py.


Member Function Documentation

def gridfs::grid_file::GridOut::__getattr__ (   self,
  name 
)

Definition at line 366 of file grid_file.py.

def gridfs::grid_file::GridOut::__init__ (   self,
  root_collection,
  file_id = None,
  file_document = None 
)
Read a file from GridFS

Application developers should generally not need to
instantiate this class directly - instead see the methods
provided by :class:`~gridfs.GridFS`.

Either `file_id` or `file_document` must be specified,
`file_document` will be given priority if present. Raises
:class:`TypeError` if `root_collection` is not an instance of
:class:`~pymongo.collection.Collection`.

:Parameters:
  - `root_collection`: root collection to read from
  - `file_id`: value of ``"_id"`` for the file to read
  - `file_document`: file document from `root_collection.files`

.. versionadded:: 1.9
   The `file_document` parameter.

Definition at line 312 of file grid_file.py.

def gridfs::grid_file::GridOut::__iter__ (   self  ) 
Return an iterator over all of this file's data.

The iterator will return chunk-sized instances of
:class:`str`. This can be useful when serving files using a
webserver that handles such an iterator efficiently.

Definition at line 461 of file grid_file.py.

def gridfs::grid_file::GridOut::read (   self,
  size = -1 
)
Read at most `size` bytes from the file (less if there
isn't enough data).

The bytes are returned as an instance of :class:`str`. If
`size` is negative or omitted all data is read.

:Parameters:
  - `size` (optional): the number of bytes to read

Definition at line 371 of file grid_file.py.

def gridfs::grid_file::GridOut::readline (   self,
  size = -1 
)
Read one line or up to `size` bytes from the file.

:Parameters:
 - `size` (optional): the maximum number of bytes to read

.. versionadded:: 1.9

Definition at line 413 of file grid_file.py.

def gridfs::grid_file::GridOut::seek (   self,
  pos,
  whence = _SEEK_SET 
)
Set the current position of this file.

:Parameters:
 - `pos`: the position (or offset if using relative
   positioning) to seek to
 - `whence` (optional): where to seek
   from. :attr:`os.SEEK_SET` (``0``) for absolute file
   positioning, :attr:`os.SEEK_CUR` (``1``) to seek relative
   to the current position, :attr:`os.SEEK_END` (``2``) to
   seek relative to the file's end.

Definition at line 434 of file grid_file.py.

def gridfs::grid_file::GridOut::tell (   self  ) 
Return the current position of this file.

Definition at line 429 of file grid_file.py.


Member Data Documentation

Definition at line 345 of file grid_file.py.

Definition at line 336 of file grid_file.py.

Definition at line 346 of file grid_file.py.

Definition at line 339 of file grid_file.py.

tuple gridfs::grid_file::GridOut::_id = _create_property("_id", "The ``'_id'`` value for this file.", True) [static, private]

Definition at line 348 of file grid_file.py.

Initial value:
_create_property("aliases", "List of aliases for this file.",
                                True)

Definition at line 359 of file grid_file.py.

Initial value:
_create_property("chunkSize", "Chunk size for this file.",
                                   True)

Definition at line 354 of file grid_file.py.

Initial value:
_create_property("contentType", "Mime-type for this file.",
                                     True)

Definition at line 350 of file grid_file.py.

Initial value:
_create_property("length", "Length (in bytes) of this file.",
                               True)

Definition at line 352 of file grid_file.py.

Initial value:
_create_property("md5", "MD5 of the contents of this file "
                            "(generated on the server).", True)

Definition at line 363 of file grid_file.py.

Initial value:
_create_property("metadata", "Metadata attached to this file.",
                                 True)

Definition at line 361 of file grid_file.py.

tuple gridfs::grid_file::GridOut::name = _create_property("filename", "Name of this file.", True) [static]

Definition at line 349 of file grid_file.py.

Initial value:
_create_property("uploadDate",
                                    "Date that this file was first uploaded.",
                                    True)

Definition at line 356 of file grid_file.py.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


pymongo
Author(s): Bhaskara Marthi
autogenerated on Fri Jan 11 10:09:06 2013