This patch also has one unrelated change, creating INSTANCE_DIR as a global.
a86 12
INSTANCE_DIR = 'instance'
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)
a444 4
self.dirty = bool(handle or create_jobject) #do not save if not dirty.
#Individual activities responsible for setting and clearing
#this flag, but activity.py respects it.
d694 1
a694 1
logging.debug('Activity.save: %r' % self._jobject.object_id if self._jobject else 'NOTHING')
a699 4
if not self.dirty:
logging.info('Activity.save: no need, nothing has happened since last save.')
return
d710 1
a710 1
file_path = os.path.join(self.get_activity_root(), INSTANCE_DIR,
d713 2
a714 4
if os.path.isfile(file_path):
self._owns_file = True
if self._jobject:
self._jobject.file_path = file_path
a771 2
logging.debug(u'DIRTY')
self.dirty = True #force a save of new data.
d908 1
a908 1
return WarningDictionary()
_______________________________________________
Sugar mailing list
[email protected]
http://lists.laptop.org/listinfo/sugar