Development Team/Almanac/sugar.datastore.datastore: Difference between revisions

Line 134: Line 134:
= Class: DSObject =
= Class: DSObject =


=== How do I create access the metadata entries for a datastore object? ===
=== How do I access the metadata entries for a datastore object? ===
Every DSObject created by datastore.create() has a metadata property. This property refers to a [[#Class: DSMetadata | DSMetadata object]], which contains the metadata for your datastore object. The code below shows how to read metadata values by referring to the metadata property of a DSObject. metadata is a Python dictionary object.
Every DSObject created by datastore.create() has a metadata property. This property refers to a [[#Class: DSMetadata | DSMetadata object]], which contains the metadata for your datastore object. The code below shows how to read metadata values by referring to the metadata property of a DSObject. metadata is a Python dictionary object.
<pre>
<pre>
Line 146: Line 146:
         print my_dsobject.metadata['description']
         print my_dsobject.metadata['description']


         #other standard objects in the metadata dictionary include 'tags',  
         #other standard objects in the metadata dictionary include 'tags', 'title', 'mimetypes', ...
</pre>
</pre>