DatastoreUsagePatterns

From OLPC
Revision as of 22:55, 20 January 2008 by 72.255.6.235 (talk)
Jump to navigation Jump to search

Write

session_data = self.get_document_data()

jobject = datastore.create()
jobject.metadata['title'] = 'Write activity'
jobject.metadata['mime_type'] = 'application/vnd.oasis.opendocument.text' 
jobject.metadata['...

f = open(temp_path_in_instance_dir, 'w')
f.write(session_data)
f.close()

jobject.file_path = temp_path_in_instance_dir
datastore.write(jobject)


Record

session_data = self.serialize_session()

jobject = datastore.create()
jobject.metadata['title'] = 'Record activity'
jobject.metadata['...

f = open(temp_path_in_instance_dir, 'w')
f.write(session_data)
f.close()

jobject.file_path = temp_path_in_instance_dir
datastore.write(jobject)


jobject = datastore.create()
jobject.metadata['title'] = 'Photo by Tomeu'
jobject.metadata['mime_type'] = 'image/png'
jobject.metadata['...

f = open(temp_path_in_instance_dir2, 'w')
f.write(png_data)
f.close()

jobject.file_path = temp_path_in_instance_dir2
datastore.write(jobject)


jobject = datastore.create()
jobject.metadata['title'] = 'Video by Tomeu'
jobject.metadata['mime_type'] = 'video/ogg'
jobject.metadata['...

f = open(temp_path_in_instance_dir3, 'w')
f.write(ogg_data)
f.close()

jobject.file_path = temp_path_in_instance_dir3
datastore.write(jobject)