app/soc/logic/models/base.py
changeset 2736 8f3935f0f4ba
parent 2709 7a595f688ab5
child 2756 054810192277
equal deleted inserted replaced
2735:74f0972f523f 2736:8f3935f0f4ba
   376     for key in order:
   376     for key in order:
   377       query.order(key)
   377       query.order(key)
   378 
   378 
   379     return query
   379     return query
   380 
   380 
   381   def updateEntityProperties(self, entity, entity_properties, silent=False):
   381   def updateEntityProperties(self, entity, entity_properties, silent=False,
       
   382                              store=True):
   382     """Update existing entity using supplied properties.
   383     """Update existing entity using supplied properties.
   383 
   384 
   384     Args:
   385     Args:
   385       entity: a model entity
   386       entity: a model entity
   386       entity_properties: keyword arguments that correspond to entity
   387       entity_properties: keyword arguments that correspond to entity
   387         properties and their values
   388         properties and their values
   388       silent: iff True does not call _onUpdate method
   389       silent: iff True does not call _onUpdate method
       
   390       store: iff True updated entity is actually stored in the data model
   389 
   391 
   390     Returns:
   392     Returns:
   391       The original entity with any supplied properties changed.
   393       The original entity with any supplied properties changed.
   392     """
   394     """
   393 
   395 
   406 
   408 
   407       if self._updateField(entity, entity_properties, name):
   409       if self._updateField(entity, entity_properties, name):
   408         value = entity_properties[name]
   410         value = entity_properties[name]
   409         prop.__set__(entity, value)
   411         prop.__set__(entity, value)
   410 
   412 
   411     entity.put()
   413     if store:
       
   414       entity.put()
   412 
   415 
   413     # call the _onUpdate method
   416     # call the _onUpdate method
   414     if not silent:
   417     if not silent:
   415       self._onUpdate(entity)
   418       self._onUpdate(entity)
   416 
   419