Package comodit_client :: Package api :: Module sync :: Class FileProvider

Class FileProvider


Base class providing an "interface" for file access facilities.

Instance Methods
bool
exists(self, name)
Checks if a file exists.
bool
thumb_exists(self)
Checks if a thumbnail exists.
file-like object
open(self, name)
Opens an existing file.
file-like object
open_thumb(self)
Opens an existing thumbnail.
 
close(self, fd)
Closes given file-like object obtained through open or open_thumb.

Inherited from object: __long__, __native__, __nonzero__, __unicode__, next

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

exists(self, name)

 

Checks if a file exists.

Parameters:
  • name (string) - File's name.
Returns: bool
True if the file exists, false otherwise.

thumb_exists(self)

 

Checks if a thumbnail exists.

Returns: bool
True if the thumbnail exists, false otherwise.

open(self, name)

 

Opens an existing file.

Parameters:
  • name (string) - File's name.
Returns: file-like object
A readable file i.e. an object implementing a file object's read method.

open_thumb(self)

 

Opens an existing thumbnail.

Returns: file-like object
A readable file i.e. an object implementing a file object's read method.

close(self, fd)

 

Closes given file-like object obtained through open or open_thumb.

Parameters:
  • fd (file-like object) - a file-like object.