DatastoreUsagePatterns: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 30: | Line 30: | ||
jobject.file_path = temp_path_in_instance_dir |
jobject.file_path = temp_path_in_instance_dir |
||
datastore.write(jobject) |
datastore.write(jobject) |
||
jobject = datastore.create() |
jobject = datastore.create() |
||
Line 42: | Line 43: | ||
jobject.file_path = temp_path_in_instance_dir2 |
jobject.file_path = temp_path_in_instance_dir2 |
||
datastore.write(jobject) |
datastore.write(jobject) |
||
jobject = datastore.create() |
jobject = datastore.create() |
||
Line 54: | 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)