DatastoreUsagePatterns

From OLPC

Revision as of 23:09, 20 January 2008 by Tomeu (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, 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)
Personal tools
  • Log in
  • Login with OpenID
About OLPC
About the laptop
About the tablet
Projects
OLPC wiki
Toolbox