Package comodit_client :: Package api :: Module sync :: Class LocalFileProvider

Class LocalFileProvider


Helper class providing local file access facilities.

Instance Methods
 
__init__(self, folder)
Creates a new local file provider.
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__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, folder)
(Constructor)

 

Creates a new local file provider.

Parameters:
  • folder (string) - Path to local directory.
Overrides: object.__init__

exists(self, name)

 

Checks if a file exists.

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

thumb_exists(self)

 

Checks if a thumbnail exists.

Returns: bool
True if the thumbnail exists, false otherwise.
Overrides: FileProvider.thumb_exists
(inherited documentation)

open(self, name)

 

Opens an existing file.

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

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.
Overrides: FileProvider.open_thumb
(inherited documentation)

close(self, fd)

 

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

Parameters:
  • fd - a file-like object.
Overrides: FileProvider.close
(inherited documentation)