Hi, +class WarningDictionary(dict): + def __getitem__(self,key): + warnings.warn("Trying to get key %s in unallocated activity metadata dictionary %s"%(key,self), + RuntimeWarning, stacklevel=2) + return None + def __setetitem__(self,key,value): + warnings.warn("Trying to set key %s in unallocated activity metadata dictionary %s"%(key,self), + RuntimeWarning, stacklevel=2) + return dict.__setitem__(self,key,value)
Why do you think this is needed? + self.dirty = bool(handle or create_jobject) #do not save if not dirty. Why bool() and why not just initialize it to True? What do you think about using is_dirty instead so it's clearer that it's a flag? + #Individual activities responsible for setting and clearing + #this flag, but activity.py respects it. Perhaps this should be a pydocs comment? + logging.debug('Activity.save: %r' % self._jobject.object_id if self._jobject else 'NOTHING') ... + if self._jobject: Wouldn't be better to make sure that this method doesn't get executed if there's no jobject? + logging.info('Activity.save: no need, nothing has happened since last save.') Should be logging.debug instead? One concern I have about the general approach is that the activity author needs to set dirty to False after a successful save, but that info (when a save has finished successfully) is not available to the activity. Thanks, Tomeu _______________________________________________ Sugar mailing list Sugar@lists.laptop.org http://lists.laptop.org/listinfo/sugar