本文整理汇总了Python中api_db_utils.APIDB.update_subscription方法的典型用法代码示例。如果您正苦于以下问题:Python APIDB.update_subscription方法的具体用法?Python APIDB.update_subscription怎么用?Python APIDB.update_subscription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api_db_utils.APIDB
的用法示例。
在下文中一共展示了APIDB.update_subscription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: coach_course_subscription_update_level
# 需要导入模块: from api_db_utils import APIDB [as 别名]
# 或者: from api_db_utils.APIDB import update_subscription [as 别名]
def coach_course_subscription_update_level(req, uskey_subscription):
"""
``PUT`` @ |ca| + ``/subscriptions/<uskey_subscription>/level``
Updates the level of a subscription. |uroleOT|
"""
subscription = req.model
j_req = json_from_request(req, mandatory_props=['profileLevel'], optional_props=['increaseLevel'])
APIDB.update_subscription(subscription, **j_req)
return HttpEmpty()
示例2: coach_course_subscription_update
# 需要导入模块: from api_db_utils import APIDB [as 别名]
# 或者: from api_db_utils.APIDB import update_subscription [as 别名]
def coach_course_subscription_update(req, uskey_subscription):
"""
``PUT`` @ |ca| + ``/subscriptions/<uskey_subscription>``
Updates a subscription. |uroleOT|
"""
subscription = req.model
j_req = json_from_request(req,
optional_props=['profileLevel', 'feedback', 'increaseLevel',
('disabledExercises', []), ('observations', [])])
disabled_exercises = [Key(urlsafe=e) for e in j_req['disabled_exercises']]
observations = [Observation(text=e['text'], created_by=Key(urlsafe=e['createdBy'] or req.user.id)) for e in
j_req['observations']]
# delete if empty, otherwise are removed.
if disabled_exercises is not None:
j_req['disabled_exercises'] = disabled_exercises
else:
del j_req['disabled_exercises']
if observations:
j_req['observations'] = observations
else:
del j_req['observations']
APIDB.update_subscription(subscription, ['role'], **j_req)
return HttpEmpty()