Package datafinder :: Package script_api :: Package item :: Module item_support
[hide private]
[frames] | no frames]

Module item_support

Module that supports simple item operations.


Version: $Revision-Id$

Functions [hide private]
 
refresh(path, stateOnly=False)
Resets the state of the item so that its information is reloaded when accessed.
 
createCollection(path, properties=None)
Creates a collection.
 
createLeaf(path, properties=None)
Creates a leaf.
 
createLink(path, linkTargetPath)
Creates a link.
 
_createItem(cwr, item, properties=None)
Creates the given item object.
tuple, unicode unicode
getChildParentPath(path)
Returns the child name and parent path.
 
delete(path)
Deletes the item.
 
copy(sourcePath, targetPath)
Copies an item.
 
move(sourcePath, targetPath)
Moves an item.
 
_getItemHelper(sourcePath, targetPath)
Helper which fetches an item and an empty targetItem.
 
retrieveData(path)
Receives the data associated with this item.
 
storeData(path, fileObject)
Stores the data that has to be associated with this item.
list of unicode
search(path, restrictions)
Search the given item path.
 
createArchive(path, targetPath, defaultProperties=None)
Archives the given path.
 
performImport(sourcePath, targetParentPath, targetRepository, defaultProperties=None, copyData=True, ignoreLinks=False, determinePropertiesCallback=None)
This method initiates the copy process and starts walking the source creating a new node in the destination tree for each item it passes.
 
_createDeterminePropertiesCallback(baseFunction, cwr)
Adds parameter conversion to the original callback function.
 
_mapProperties(reqPropDefs, properties, cwr)
Converts the given properties.
 
walk(path)
ItemDescription
itemDescription(path)
Returns the item description for the given item path.
 
getChildren(path)
Determines the children of the given item.
 
registerListener(event, observer)
Register for an item event
 
_getEvent(identifier)
Maps different event identifiers to the corresponding Events
Variables [hide private]
  __package__ = 'datafinder.script_api.item'
Function Details [hide private]

refresh(path, stateOnly=False)

 

Resets the state of the item so that its information is reloaded when accessed.

Parameters:
  • path (unicode) - The item to refresh.
  • itemStateOnly - If set it indicates that only the item state is refreshed but no structural information. Default is False
  • stateOnly (bool)

createCollection(path, properties=None)

 

Creates a collection.

Parameters:
  • path (unicode) - Path of the collection which should be created.
  • properties (dict of unicode, object) - Creation properties of the collection.
Raises:

createLeaf(path, properties=None)

 

Creates a leaf.

Parameters:
  • path (unicode) - Path of the leaf which should be created.
  • properties (dict of unicode, object) - Creation properties of the leaf.
Raises:

createLink(path, linkTargetPath)

 

Creates a link.

Parameters:
  • path (unicode) - Path of the link which should be created.
  • linkTargetPath (unicode) - Path of the item which is referenced by the link.
Raises:

_createItem(cwr, item, properties=None)

 

Creates the given item object.

Raises:

getChildParentPath(path)

 

Returns the child name and parent path.

Parameters:
  • path (unicode) - The item path.
Returns: tuple, unicode unicode
Child name and parent path

delete(path)

 

Deletes the item.

Parameters:
  • path (unicode) - Path to the item which has to be deleted.
Raises:

copy(sourcePath, targetPath)

 

Copies an item.

Parameters:
  • sourcePath (unicode) - Path of the source item.
  • targetPath (unicode) - Path of the target item representing the copied item.
Raises:

move(sourcePath, targetPath)

 

Moves an item.

Parameters:
  • sourcePath (unicode) - Path of the source item.
  • targetPath (unicode) - Path of the target item representing the moved item.
Raises:

_getItemHelper(sourcePath, targetPath)

 

Helper which fetches an item and an empty targetItem.

Parameters:
  • sourcePath (unicode) - The source item path.
  • targetPath (unicode) - The target item path.

retrieveData(path)

 

Receives the data associated with this item.

Parameters:
  • path (unicode) - Path of the item form the data should be retrieved.
Returns:
Readable file-like object.
Raises:

storeData(path, fileObject)

 

Stores the data that has to be associated with this item.

Parameters:
  • path (unicode) - Path of the item where the data should be stored.
  • fileObj - File-like object that can be read from.
Raises:

search(path, restrictions)

 

Search the given item path.

Parameters:
  • path (unicode) - Path of the item where the search should start.
  • restrictions (unicode) - The search restrictions.
Returns: list of unicode
List of items paths matching the given query.
Raises:
  • ItemSupportError - Indicates problems while parsing the restrictions or executing the search.

performImport(sourcePath, targetParentPath, targetRepository, defaultProperties=None, copyData=True, ignoreLinks=False, determinePropertiesCallback=None)

 

This method initiates the copy process and starts walking the source creating a new node in the destination tree for each item it passes.

Parameters:
  • sourcePath (unicode) - The item that should be imported.
  • targetParentPath (unicode) - The collection that should afterwards contain the copy.
  • targetRepository (Repository) - The repository that should afterwards contain the copy.
  • defaultProperties (dict of unicode,object) - Optional properties which are set for every item. Default: None
  • copyData (bool) - Flag indicating whether data of imported leafs is copy as well. Default: True
  • ignoreLinks (bool) - Flag indicating the links are ignored during import. Default: False
  • determinePropertiesCallback - Function determining properties used when importing a specific item.
Raises:

walk(path)

 
Parameters:
  • path (unicode) - The item where the walk should start.
Raises:

See Also: walk method to add further post-processing.

itemDescription(path)

 

Returns the item description for the given item path.

Parameters:
  • path (unicode) - Path identifying the item.
Returns: ItemDescription
Item description instance.