DatastoreUsagePatterns: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 56: | Line 56: | ||
jobject.file_path = temp_path_in_instance_dir3 |
jobject.file_path = temp_path_in_instance_dir3 |
||
datastore.write(jobject) |
datastore.write(jobject) |
||
[[Category:DatastoreRedesign]] |
Latest revision as of 23:09, 20 January 2008
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)