#4651 NORM Update.: Sugar should make better use of tmp space

Zarro Boogs per Child bugtracker at laptop.org
Thu Nov 8 07:16:35 EST 2007


#4651: Sugar should make better use of tmp space
---------------------+------------------------------------------------------
  Reporter:  tomeu   |       Owner:  tomeu   
      Type:  defect  |      Status:  new     
  Priority:  normal  |   Milestone:  Update.1
 Component:  sugar   |     Version:          
Resolution:          |    Keywords:          
  Verified:  0       |  
---------------------+------------------------------------------------------

Comment(by tomeu):

 Replying to [comment:1 tomeu]:
 > From #4164. ActivityBundle.get_icon:
 >
 > {{{
 >     # FIXME: this should return the icon data, not a filename, so that
 >     # we don't need to create a temp file in the zip case
 >     def get_icon(self):
 >         """Get the activity icon name"""
 >         icon_path = os.path.join('activity', self._icon + '.svg')
 >         if self._unpacked:
 >             return os.path.join(self._path, icon_path)
 >         else:
 >             icon_data = self._get_file(icon_path).read()
 >             temp_file, temp_file_path = tempfile.mkstemp(self._icon)
 >             os.write(temp_file, icon_data)
 >             os.close(temp_file)
 >             return temp_file_path
 > }}}
 >
 > In this case, we can easily create a StringIO.StringIO so the svg data
 is kept in RAM, or change the API to return a string with the svg data.

 I would go for the latter.

-- 
Ticket URL: <http://dev.laptop.org/ticket/4651#comment:5>
One Laptop Per Child <http://dev.laptop.org>
OLPC bug tracking system



More information about the Bugs mailing list