[Bugs] #1040 UNSP: Traceback when copying file of unknown MIME type to USB stick
SugarLabs Bugs
bugtracker-noreply at sugarlabs.org
Sun Jul 12 07:20:08 EDT 2009
#1040: Traceback when copying file of unknown MIME type to USB stick
------------------------------------------+---------------------------------
Reporter: sascha_silbe | Owner: tomeu
Type: defect | Status: new
Priority: Unspecified by Maintainer | Milestone: 0.86
Component: sugar | Version: Git as of bugdate
Severity: Unspecified | Keywords: r?
Distribution: Unspecified | Status_field: New
------------------------------------------+---------------------------------
When trying to copy a Calculate instance I get the following traceback:
Traceback (most recent call last):
File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-
packages/jarabe/journal/volumestoolbar.py", line 141, in
_drag_data_received_cb
model.copy(metadata, self.mount_point)
File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-
packages/jarabe/journal/model.py", line 459, in copy
return write(metadata, file_path)
File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-
packages/jarabe/journal/model.py", line 487, in write
file_name = _get_file_name(metadata['title'], metadata['mime_type'])
File "/home/sascha.silbe/sugar-jhbuild/install/lib/python2.5/site-
packages/jarabe/journal/model.py", line 499, in _get_file_name
extension = '.' + mime.get_primary_extension(mime_type)
TypeError: cannot concatenate 'str' and 'NoneType' objects
This is because sugar.mime.get_primary_extension() returns None if no
extension for the given MIME type is known.
The attached patch handles this case by substituting the empty string
instead.
--
Ticket URL: <http://dev.sugarlabs.org/ticket/1040>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system
More information about the Bugs
mailing list