[Sugar-devel] [PATCH] Change the logic used to determine the format used to save files.
gonzalo at laptop.org
Thu Oct 14 16:23:35 EDT 2010
On Thu, Oct 14, 2010 at 5:08 PM, Sascha Silbe <
sascha-ml-reply-to-2010-3 at silbe.org> wrote:
> Excerpts from godiard's message of Thu Oct 14 20:10:14 +0200 2010:
> > Fix the tickets OLPC #5291, OLPC #1925, SL #2127
> Please provide some background information as part of the patch
> description. What are you changing and why?
> Please mention the module name as part of the patch summary, e.g.:
> [PATCH Write] keep file type across load/save (SL #2127)
The subject is created by git send-email. I can change the first line from
the patch, but no how you say.
> a) ensures maintainers notice patches for their modules and
> b) enables reviewers to prioritise patches depending on how well they
> know the module.
> > @@ -423,28 +423,38 @@ class AbiWordActivity (activity.Activity):
> self.participants[buddy.object_path()], 0, 0)
> > def read_file(self, file_path):
> > - logging.debug('AbiWordActivity.read_file: %s, mimetype: %s',
> file_path, self.metadata['mime_type'])
> > - if 'source' in self.metadata and self.metadata['source'] == '1':
> > - logger.debug('Opening file in view source mode')
> > - self.abiword_canvas.load_file('file://' + file_path,
> > + logging.debug('AbiWordActivity.read_file: %s, mimetype: %s',
> > + file_path, self.metadata['mime_type'])
> Please don't mix style changes with bug fixes.
> > + if self.metadata['mime_type'] in ['text/plain', 'text/csv']:
> > + logging.debug('Opening file in text mode')
> > + self.abiword_canvas.load_file('file://' + file_path,
> > else:
> > self.abiword_canvas.load_file('file://' + file_path, '') #
> we pass no mime/file type, let libabiword autodetect it, so we can handle
> multiple file formats
> I fail to see how this addresses (one of?) the tickets you mentioned.
> Also it will cause the activity to break if the Journal entry doesn't
> have a MIME type set.
The code correct http://bugs.sugarlabs.org/ticket/2127 where .csv files are
opened and saved like odt files.
That is because canvas.load_file must be called with the mime type (and
> Same comments as for read_file().
> > + # change the extension in the file name and the
> > + self._change_file_ext(self.metadata['title'], '.odt')
> > + self._change_file_ext(self.metadata['description'],
> Randomly changing user-set metadata is a no-no.
Not randomly. Write save the files like OpenDocument but don't change the
If you copy the file from the journal to a pen drive or look at the file in
the datastore can see it.
It's difficult to see the actual behavior in the patch, but I have tested it
a long time.
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Sugar-devel