本文整理汇总了Python中models.Team.Team.boxes方法的典型用法代码示例。如果您正苦于以下问题:Python Team.boxes方法的具体用法?Python Team.boxes怎么用?Python Team.boxes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Team.Team
的用法示例。
在下文中一共展示了Team.boxes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_team
# 需要导入模块: from models.Team import Team [as 别名]
# 或者: from models.Team.Team import boxes [as 别名]
def create_team(self):
''' Create a new team '''
if not self.config.teams:
team = Team.by_name(self.get_argument('handle', ''))
if team is None:
team = Team()
team.name = self.get_argument('handle', '')
else:
logging.info("Team %s already exists - Player Mode: reset team." % team.name)
team.flags = []
team.hints = []
team.boxes = []
team.items = []
team.game_levels = []
team.purchased_source_code = []
team.motto = self.get_argument('motto', '')
if self.config.banking:
team.money = self.config.starting_team_money
else:
team.money = 0
level_0 = GameLevel.by_number(0)
if not level_0:
level_0 = GameLevel.all()[0]
team.game_levels.append(level_0)
return team
elif self.config.public_teams:
if Team.by_name(self.get_argument('team_name', '')) is not None:
raise ValidationError("This team name is already registered. Use team code to join that team.")
team = Team()
team.name = self.get_argument('team_name', '')
team.motto = self.get_argument('motto', '')
if not self.config.banking:
team.money = 0
level_0 = GameLevel.by_number(0)
if not level_0:
level_0 = GameLevel.all()[0]
team.game_levels.append(level_0)
return team
else:
raise ValidationError("Public teams are not enabled")