当前位置: 首页>>代码示例>>Python>>正文


Python Place.set_owner方法代码示例

本文整理汇总了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:
开发者ID:sphoebs,项目名称:rockshell,代码行数:33,代码来源:logic.py


注:本文中的models.Place.set_owner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。