sugar3.datastore.datastore module¶
STABLE
-
class
sugar3.datastore.datastore.DSMetadata(properties=None)¶ Bases:
gi.overrides.GObject.ObjectA representation of the metadata associated with a DS entry.
-
copy()¶
-
get(key, default=None)¶
-
get_dictionary()¶
-
has_key(key)¶
-
keys()¶
-
update(properties)¶ Update all of the metadata
-
-
class
sugar3.datastore.datastore.DSObject(object_id, metadata=None, file_path=None)¶ Bases:
objectA representation of a DS entry.
-
copy()¶
-
destroy()¶
-
file_path¶
-
get_file_path(fetch=True)¶
-
get_metadata()¶
-
get_object_id()¶
-
metadata¶
-
object_id¶
-
set_file_path(file_path)¶
-
set_metadata(metadata)¶
-
set_object_id(object_id)¶
-
-
class
sugar3.datastore.datastore.RawObject(file_path)¶ Bases:
objectA representation for objects not in the DS but in the file system.
-
destroy()¶
-
file_path¶
-
get_file_path(fetch=True)¶
-
get_metadata()¶
-
metadata¶
-
-
sugar3.datastore.datastore.copy(ds_object, mount_point)¶ Copy a datastore entry
Keyword arguments: ds_object – DSObject to copy mount_point – mount point of the new datastore entry
-
sugar3.datastore.datastore.create()¶ Create a new DSObject.
Return: a DSObject
-
sugar3.datastore.datastore.delete(object_id)¶ Delete the datastore entry with the given uid.
Keyword arguments: object_id – uid of the datastore entry
-
sugar3.datastore.datastore.find(query, sorting=None, limit=None, offset=None, properties=None, reply_handler=None, error_handler=None)¶ Find DS entries that match the query provided.
Keyword arguments: query – a dictionary containing metadata key value pairs
for a fulltext search use the key ‘query’ e.g. {‘query’: ‘blue*’} other possible well-known properties are: ‘activity’: ‘my.organization.MyActivity’ ‘activity_id’: ‘6f7f3acacca87886332f50bdd522d805f0abbf1f’ ‘title’: ‘My new project’ ‘title_set_by_user’: ‘0’ ‘keep’: ‘0’ ‘ctime’: ‘1972-05-12T18:41:08’ ‘mtime’: ‘2007-06-16T03:42:33’ ‘timestamp’: 1192715145 ‘preview’: ByteArray(png file data, 300x225 px) ‘icon-color’: ‘#ff0000,#ffff00’ ‘mime_type’: ‘application/x-my-activity’ ‘share-scope’: # if shared ‘buddies’: ‘{}’ ‘description’: ‘some longer text’ ‘tags’: ‘one two’sorting – key to order results by e.g. ‘timestamp’ (default None) limit – return only limit results (default None) offset – return only results starting at offset (default None) properties – you can specify here a list of metadata you want to be
present in the result e.g. [‘title, ‘keep’] (default None)- reply_handler – will be called with the method’s return values as
- arguments (default None)
- error_handler – will be called with an instance of a DBusException
- representing a remote exception (default None)
Return: DSObjects matching the query, number of matches
-
sugar3.datastore.datastore.get(object_id)¶ Get the properties of the object with the ID given.
Keyword arguments: object_id – unique identifier of the object
Return: a DSObject
-
sugar3.datastore.datastore.get_unique_values(key)¶ Retrieve an array of unique values for a field.
Keyword arguments: key – only the property activity is currently supported
Return: list of activities
-
sugar3.datastore.datastore.write(ds_object, update_mtime=True, transfer_ownership=False, reply_handler=None, error_handler=None, timeout=-1)¶ Write the DSObject given to the datastore. Creates a new entry if the entry does not exist yet.
Keyword arguments: update_mtime – boolean if the mtime of the entry should be regenerated
(default True)- transfer_ownership – set it to true if the ownership of the entry should
- be passed - who is responsible to delete the file when done with it (default False)
- reply_handler – will be called with the method’s return values as
- arguments (default None)
- error_handler – will be called with an instance of a DBusException
- representing a remote exception (default None)
timeout – dbus timeout for the caller to wait (default -1)