app/soc/logic/models/base.py
changeset 1517 a467d13e34ea
parent 1516 8df06dc877aa
child 1518 f6f43a1675eb
equal deleted inserted replaced
1516:8df06dc877aa 1517:a467d13e34ea
   356     for name, prop in properties.iteritems():
   356     for name, prop in properties.iteritems():
   357       # if the property is not updatable or is not updated, skip it
   357       # if the property is not updatable or is not updated, skip it
   358       if name in self._skip_properties or (name not in entity_properties):
   358       if name in self._skip_properties or (name not in entity_properties):
   359         continue
   359         continue
   360 
   360 
   361       if self._updateField(entity, name, value):
   361       if self._updateField(entity, entity_properties, name):
       
   362         value = entity_properties[name]
   362         prop.__set__(entity, value)
   363         prop.__set__(entity, value)
   363 
   364 
   364     entity.put()
   365     entity.put()
   365     return entity
   366     return entity
   366 
   367 
   416 
   417 
   417     entity.delete()
   418     entity.delete()
   418     # entity has been deleted call _onDelete
   419     # entity has been deleted call _onDelete
   419     self._onDelete(entity)
   420     self._onDelete(entity)
   420 
   421 
   421   def _updateField(self, entity, name, value):
   422   def _updateField(self, entity, entity_properties, name):
   422     """Hook called when a field is updated.
   423     """Hook called when a field is updated.
   423 
   424 
   424     Base classes should override if any special actions need to be
   425     Base classes should override if any special actions need to be
   425     taken when a field is updated. The field is not updated if the
   426     taken when a field is updated. The field is not updated if the
   426     method does not return a True value.
   427     method does not return a True value.