#5863 NORM Never A: downloaded bundles appear in the journal with unknown icon until reboot

Zarro Boogs per Child bugtracker at laptop.org
Sat Jan 5 12:06:05 EST 2008


#5863: downloaded bundles appear in the journal with unknown icon until reboot
-------------------------------+--------------------------------------------
 Reporter:  tomeu              |       Owner:  tomeu         
     Type:  defect             |      Status:  new           
 Priority:  normal             |   Milestone:  Never Assigned
Component:  journal-activity   |     Version:                
 Keywords:  Update.1? review?  |    Verified:  0             
 Blocking:                     |   Blockedby:                
-------------------------------+--------------------------------------------
 If you download a bundle, an entry will be created during the download in
 the journal with a generic "object unknown" icon.

 This is because at that time we don't have still the file and thus cannot
 extract the icon.

 But after the download finishes, we still don't display the right icon,
 although it is already available inside the bundle.

 This is because we are caching icons and don't notice that the entry has
 changed.

 This patch fixes this:

 {{{
 diff --git a/misc.py b/misc.py
 index b1b8144..418c0ac 100644
 --- a/misc.py
 +++ b/misc.py
 @@ -48,8 +48,9 @@ _icon_cache = LRU(50)

  def get_icon_name(jobject):

 -    if jobject.object_id in _icon_cache:
 -        return _icon_cache[jobject.object_id]
 +    cache_key = (jobject.object_id, jobject.metadata['timestamp'])
 +    if cache_key in _icon_cache:
 +        return _icon_cache[cache_key]

      file_name = None

 @@ -77,7 +78,7 @@ def get_icon_name(jobject):
      if not file_name:
          return _get_icon_file_name('application-octet-stream')

 -    _icon_cache[jobject.object_id] = file_name
 +    _icon_cache[cache_key] = file_name

      return file_name

 }}}

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



More information about the Bugs mailing list