[sugar] Deleting journal entry
Arjun Sarwal
arjun at laptop.org
Thu Aug 21 14:38:26 EDT 2008
Hi,
I am using the following piece of code from one of Sugar's files to
create a journal entry whenever a logging session (which is a set of
csv values) is created within Measure Activity.
Whenever user records a few values, a journal entry gets created. When
he choses to record a few more values another journal entry gets
created which is still basically pointing to the same file that has
been updated with few more values. How can I delete the previous
entry.
Just an overview of required steps would be good for me to start with.,..
Thanks a lot.
regards
Arjun
try:
jobject = datastore.create()
try:
jobject.metadata['title'] = _('Log values ' +
str(waveform_id) + ' ,from Measure Activity')
jobject.metadata['keep'] = '0'
jobject.metadata['buddies'] = ''
jobject.metadata['preview'] = ''
jobject.metadata['icon-color'] = profile.get_color().to_string()
jobject.metadata['mime_type'] = 'text/csv'
jobject.file_path = file_path
datastore.write(jobject)
finally:
jobject.destroy()
del jobject
finally:
os.remove(file_path)
More information about the Sugar
mailing list