app_util.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:raw-data-repository 作者: all-of-us 项目源码 文件源码
def update_model(old_model, new_model):
  """Updates a model.
  For all fields that are set in new_model, copy them into old_model.

  Args:
    old_model: The ndb model object retrieved from the datastore.
    new_model_dict: A json object containing the new values.
  """

  for k, v in new_model.to_dict().iteritems():
    if type(getattr(type(new_model), k)) != ndb.ComputedProperty and v is not None:
      setattr(old_model, k, v)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号