5.3.2. Data — Simple data storage and retrieval¶
The Data module provides an easy to use data storage system for arbitrary data or more complicated Python objects. The framework stores data in separate files, using a different location for each plug-in, and identifies each item with a unique name.
Note
It is the responsibility of the developer to ensure that the correct storage methods (binary or object) and types are used when retrieving stored data.
This module defines the following functions:
- Data.Exists(itemName)¶
Checks whether a data item with the given name exists
Parameter: itemName (str) – The name of the item Returns: True if the item exists Return type: bool
- Data.Load(itemName)¶
Loads previously saved binary data from a data item.
Parameter: itemName (str) – The name of the item Returns: The stored data, if available Return type: str or None
- Data.LoadObject(itemName)¶
Loads a previously saved Python object from a data item.
Parameter: itemName (str) – The name of the item Returns: The stored object, if available Return type: object or None
- Data.Save(itemName, data)¶
Stores the provided data as an item with the given name.
Parameters: - itemName (str) – The name of the item
- data (str) – The binary data to store
- Data.SaveObject(itemName, data)¶
Stores the provided Python object as an item with the given name.
Parameters: - itemName (str) – The name of the item
- data (object) – The Python object to store
- Data.Remove(itemName)¶
Removes a given data item.
Parameter: itemName (str) – The name of the item