當前位置: 首頁>>代碼示例>>Python>>正文


Python Actor.to_db方法代碼示例

本文整理匯總了Python中models.Actor.to_db方法的典型用法代碼示例。如果您正苦於以下問題:Python Actor.to_db方法的具體用法?Python Actor.to_db怎麽用?Python Actor.to_db使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Actor的用法示例。


在下文中一共展示了Actor.to_db方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: put

# 需要導入模塊: from models import Actor [as 別名]
# 或者: from models.Actor import to_db [as 別名]
 def put(self, actor_id):
     dbid = Actor.get_dbid(g.tenant, actor_id)
     try:
         actor = Actor.from_db(actors_store[dbid])
     except KeyError:
         raise APIException(
             "actor not found: {}'".format(actor_id), 404)
     previous_image = actor.image
     args = self.validate_put(actor)
     args['tenant'] = g.tenant
     update_image = False
     if args['image'] == previous_image:
         args['status'] = actor.status
     else:
         update_image = True
         args['status'] = SUBMITTED
     args['api_server'] = g.api_server
     args['owner'] = g.user
     actor = Actor(**args)
     actors_store[actor.db_id] = actor.to_db()
     if update_image:
         ch = CommandChannel()
         ch.put_cmd(actor_id=actor.db_id, image=actor.image, tenant=args['tenant'])
     # return ok(result={'update_image': str(update_image)},
     #           msg="Actor updated successfully.")
     return ok(result=actor.display(),
               msg="Actor updated successfully.")
開發者ID:TACC,項目名稱:abaco,代碼行數:29,代碼來源:controllers.py

示例2: post

# 需要導入模塊: from models import Actor [as 別名]
# 或者: from models.Actor import to_db [as 別名]
 def post(self):
     args = self.validate_post()
     args['tenant'] = g.tenant
     args['api_server'] = g.api_server
     args['owner'] = g.user
     actor = Actor(**args)
     actors_store[actor.db_id] = actor.to_db()
     ch = CommandChannel()
     ch.put_cmd(actor_id=actor.db_id, image=actor.image, tenant=args['tenant'])
     add_permission(g.user, actor.db_id, 'UPDATE')
     return ok(result=actor.display(), msg="Actor created successfully.", request=request)
開發者ID:TACC,項目名稱:abaco,代碼行數:13,代碼來源:controllers.py

示例3: post

# 需要導入模塊: from models import Actor [as 別名]
# 或者: from models.Actor import to_db [as 別名]
 def post(self):
     args = self.validate_post()
     args['executions'] = {}
     args['state'] = ''
     args['subscriptions'] = []
     args['status'] = SUBMITTED
     actor = Actor(args)
     actors_store[actor.id] = actor.to_db()
     ch = CommandChannel()
     ch.put_cmd(actor_id=actor.id, image=actor.image)
     return ok(result=actor, msg="Actor created successfully.")
開發者ID:waltermoreira,項目名稱:abaco,代碼行數:13,代碼來源:actors.py

示例4: put

# 需要導入模塊: from models import Actor [as 別名]
# 或者: from models.Actor import to_db [as 別名]
 def put(self, actor_id):
     try:
         actor = Actor.from_db(actors_store[actor_id])
     except KeyError:
         raise APIException(
             "actor not found: {}'".format(actor_id), 404)
     args = self.validate_put()
     update_image = False
     args['name'] = actor['name']
     args['id'] = actor['id']
     args['executions'] = actor['executions']
     args['state'] = actor['state']
     if args['image'] == actor.image:
         args['status'] = actor.status
     else:
         update_image = True
         args['status'] = SUBMITTED
     actor = Actor(args)
     actors_store[actor.id] = actor.to_db()
     if update_image:
         ch = CommandChannel()
         ch.put_cmd(actor_id=actor.id, image=actor.image)
     return ok(result=actor, msg="Actor updated successfully.")
開發者ID:jjlittlejohn,項目名稱:abaco,代碼行數:25,代碼來源:actors.py


注:本文中的models.Actor.to_db方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。