#5660 NORM Never A: Activity.save() throws exception if create_jobject=False

Zarro Boogs per Child bugtracker at laptop.org
Mon Dec 24 05:19:57 EST 2007


#5660: Activity.save() throws exception if create_jobject=False
---------------------+------------------------------------------------------
  Reporter:  cscott  |       Owner:  tomeu         
      Type:  defect  |      Status:  new           
  Priority:  normal  |   Milestone:  Never Assigned
 Component:  sugar   |     Version:                
Resolution:          |    Keywords:  update.1?     
  Verified:  0       |    Blocking:                
 Blockedby:          |  
---------------------+------------------------------------------------------
Changes (by tomeu):

 * cc: Eben (added)


Comment:

 This would fix the issue that Scott is seeing:

 {{{
 diff --git a/lib/sugar/activity/activity.py
 b/lib/sugar/activity/activity.py
 index 96e757a..82a6473 100644
 --- a/lib/sugar/activity/activity.py
 +++ b/lib/sugar/activity/activity.py
 @@ -684,6 +684,11 @@ class Activity(Window, gtk.Container):
          own implementation of write_file() to save your Activity specific
 data.
          """

 +        if self._jobject is None:
 +            logging.warning('Activity.save() called but this activity has
 no '
 +                            'journal object!')
 +            return
 +
          logging.debug('Activity.save: %r' % self._jobject.object_id)

          if self._updating_jobject:
 }}}

 But the root problem here is that the Activity class assumes that only the
 Journal would ask for no journal support at all. As the journal is never
 closed, Scott is using a code path that wasn't anticipated.

 Eben, we want activities to be able to ask that no record appear in the
 Journal? I thought we wanted to write a new entry when the user played
 Connect, for example, even if no state is saved and the game cannot be
 resumed.

 If makes sense that some regular activities ask for no journal support at
 all, then the base Activity class should not call save() when closing one
 of those.

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



More information about the Bugs mailing list