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


Python Profile.get_profile_from_user方法代码示例

本文整理汇总了Python中models.Profile.get_profile_from_user方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.get_profile_from_user方法的具体用法?Python Profile.get_profile_from_user怎么用?Python Profile.get_profile_from_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Profile的用法示例。


在下文中一共展示了Profile.get_profile_from_user方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cancel_game

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import get_profile_from_user [as 别名]
 def cancel_game(self, request):
     """
     Cancels a Blackjack Marathon game based on key.
     """
     profile_key = Profile.get_profile_from_user().key
     Game.cancel_game(profile_key, request.urlsafe_game_key)
     return StringMessage(message='Game cancelled successfully.')
开发者ID:prestononeal,项目名称:blackjack_marathon,代码行数:9,代码来源:api.py

示例2: new_game

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import get_profile_from_user [as 别名]
 def new_game(self, request):
     """
     Creates a new Blackjack Marathon game for a user.
     """
     profile = Profile.get_profile_from_user()
     game = Game.new_game(p_key=profile.key)
     game.put()
     return game.to_form('Good luck playing Blackjack Marathon!')
开发者ID:prestononeal,项目名称:blackjack_marathon,代码行数:10,代码来源:api.py

示例3: get_user_games

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import get_profile_from_user [as 别名]
    def get_user_games(self, request):
        """Return the user's active games."""
        profile = Profile.get_profile_from_user()

        # Create ancestor query for all key matches for this user.
        # Filter on games where points_remaining > 0
        games = Game.query(ancestor=profile.key). \
            filter(Game.points_remaining > 0)
        # return set of GameForm objects per game
        return GameForms(
            items=[game.to_form() for game in games]
        )
开发者ID:prestononeal,项目名称:blackjack_marathon,代码行数:14,代码来源:api.py

示例4: make_move

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import get_profile_from_user [as 别名]
 def make_move(self, request):
     """
     Makes a move on a given Blackjack Marathon game. The move is the user's
     chosen strategy based on the current player and Dealer card hands.
     """
     # Verify the strategy passed in
     if request.strategy not in STRATEGIES:
         raise endpoints.BadRequestException('Invalid strategy {} '
                                             'passed in'.format(
                                                 request.strategy))
     return Game.apply_strategy(Profile.get_profile_from_user().key,
                                request.urlsafe_game_key,
                                request.strategy)
开发者ID:prestononeal,项目名称:blackjack_marathon,代码行数:15,代码来源:api.py

示例5: get_profile

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import get_profile_from_user [as 别名]
 def get_profile(self, request):
     """Return user profile."""
     profile = Profile.get_profile_from_user()
     return profile.to_form()
开发者ID:prestononeal,项目名称:blackjack_marathon,代码行数:6,代码来源:api.py


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