本文整理汇总了Python中models.Place.set_owner方法的典型用法代码示例。如果您正苦于以下问题:Python Place.set_owner方法的具体用法?Python Place.set_owner怎么用?Python Place.set_owner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Place
的用法示例。
在下文中一共展示了Place.set_owner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: from models import Place [as 别名]
# 或者: from models.Place import set_owner [as 别名]
- requester_id: id of the user that made the request: only admins are allowed to set owners!
Returns a tuple:
- the Place with owner set
- status message
- the http code indicating the type of error, if any
"""
try:
user = PFuser.get_by_email(user_email)
except TypeError, e:
return None, str(e), 400
if user is None:
return None, "Email does not correspond to any user", 400
try:
place = Place.set_owner(place_key_str, user.key.id(), requester_id)
except (TypeError, ValueError) as e:
return None, str(e), 400
except UnauthorizedException, e:
return None, str(e), 403
return place, "OK", 200
def place_owner_list(user_id):
"""
It retrieves the list of places for which the user is the owner.
Parameters:
- user_id: id of the user, which is owner and wants to get its own places.
Returns a tuple: