sugar.datastore package
Submodules
sugar.datastore.datastore module
STABLE
- class sugar.datastore.datastore.DSMetadata(*args: Any, **kwargs: Any)[source]
Bases:
GObject
A representation of the metadata associated with a DS entry.
- class sugar.datastore.datastore.DSObject(object_id, metadata=None, file_path=None)[source]
Bases:
object
A representation of a DS entry.
- property object_id
- property metadata
- property file_path
- class sugar.datastore.datastore.RawObject(file_path)[source]
Bases:
object
A representation for objects not in the DS but in the file system.
- property metadata
- property file_path
- sugar.datastore.datastore.get(object_id)[source]
Get the properties of the object with the ID given.
Keyword arguments: object_id – unique identifier of the object
Return: a DSObject
- sugar.datastore.datastore.write(ds_object, update_mtime=True, transfer_ownership=False, reply_handler=None, error_handler=None, timeout=-1)[source]
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)
- sugar.datastore.datastore.delete(object_id)[source]
Delete the datastore entry with the given uid.
Keyword arguments: object_id – uid of the datastore entry
- sugar.datastore.datastore.find(query, sorting=None, limit=None, offset=None, properties=None, reply_handler=None, error_handler=None)[source]
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