DatastoreUsagePatterns: Difference between revisions
Jump to navigation
Jump to search
(New page: == Record == jobject = datastore.create() jobject.metadata['title'] = 'Record activity...' jobject.metadata['... f = open(temp_path_in_instance_dir, 'w') f.write(session_data) f.c...) |
No edit summary |
||
Line 1: | Line 1: | ||
== 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 == |
== Record == |
||
session_data = self.serialize_session() |
|||
jobject = datastore.create() |
jobject = datastore.create() |
||
jobject.metadata['title'] = 'Record activity |
jobject.metadata['title'] = 'Record activity' |
||
jobject.metadata['... |
jobject.metadata['... |
||
Line 10: | Line 29: | ||
jobject.file_path = temp_path_in_instance_dir |
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) |
datastore.write(jobject) |
Revision as of 22:54, 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)