當前位置: 首頁>>代碼示例>>Python>>正文


Python Team.motto方法代碼示例

本文整理匯總了Python中models.Team.Team.motto方法的典型用法代碼示例。如果您正苦於以下問題:Python Team.motto方法的具體用法?Python Team.motto怎麽用?Python Team.motto使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Team.Team的用法示例。


在下文中一共展示了Team.motto方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: create_team

# 需要導入模塊: from models.Team import Team [as 別名]
# 或者: from models.Team.Team import motto [as 別名]
def create_team():
    team = Team()
    team.name = "TestTeam"
    team.motto = "TestMotto"
    dbsession.add(team)
    dbsession.commit()
    return team
開發者ID:AdaFormacion,項目名稱:RootTheBox,代碼行數:9,代碼來源:Helpers.py

示例2: create_team

# 需要導入模塊: from models.Team import Team [as 別名]
# 或者: from models.Team.Team import motto [as 別名]
    def create_team(self):
        ''' Admins can create teams manually '''
        try:
            name = self.get_argument('team_name', '')
            if Team.by_name(name) is not None:
                raise ValidationError("Team already exists")
            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)
            self.dbsession.add(team)
            self.dbsession.commit()

            # Avatar
            avatar_select = self.get_argument('team_avatar_select', '')
            if avatar_select and len(avatar_select) > 0:
                team._avatar = avatar_select
            elif hasattr(self.request, 'files') and 'avatar' in self.request.files:
                team.avatar = self.request.files['avatar'][0]['body']
            self.dbsession.add(team)
            self.dbsession.commit()
            self.redirect('/admin/users')
        except ValidationError as error:
            self.render("admin/create/team.html", errors=[str(error), ])
開發者ID:moloch--,項目名稱:RootTheBox,代碼行數:31,代碼來源:AdminGameObjectHandlers.py

示例3: create_team

# 需要導入模塊: from models.Team import Team [as 別名]
# 或者: from models.Team.Team import motto [as 別名]
 def create_team(self):
     ''' Create a new team in the database '''
     team = Team()
     team.name = self.get_argument('team_name', '')
     team.motto = self.get_argument('motto', '')
     level_0 = GameLevel.all()[0]
     team.game_levels.append(level_0)
     self.dbsession.add(team)
     self.dbsession.commit()
     self.redirect('/admin/view/user_objects')
開發者ID:AdaFormacion,項目名稱:RootTheBox,代碼行數:12,代碼來源:AdminHandlers.py

示例4: create_team

# 需要導入模塊: from models.Team import Team [as 別名]
# 或者: from models.Team.Team import motto [as 別名]
 def create_team(self):
     ''' Create a new team '''
     if self.config.public_teams:
         team = Team()
         team.name = self.get_argument('team_name', '')
         team.motto = self.get_argument('motto', '')
         level_0 = GameLevel.all()[0]
         team.game_levels.append(level_0)
         return team
     else:
         raise ValidationError("Public teams are not enabled")
開發者ID:WeiEast,項目名稱:RootTheBox,代碼行數:13,代碼來源:PublicHandlers.py

示例5: create_team

# 需要導入模塊: from models.Team import Team [as 別名]
# 或者: from models.Team.Team import motto [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")
開發者ID:moloch--,項目名稱:RootTheBox,代碼行數:42,代碼來源:PublicHandlers.py

示例6: create_team

# 需要導入模塊: from models.Team import Team [as 別名]
# 或者: from models.Team.Team import motto [as 別名]
 def create_team(self):
     ''' Admins can create teams manually '''
     try:
         name = self.get_argument('team_name', '')
         motto = self.get_argument('motto', '')
         if Team.by_name(name) is not None:
             raise ValidationError("Team already exists")
         team = Team()
         team.name = self.get_argument('team_name', '')
         team.motto = self.get_argument('motto', '')
         level_0 = GameLevel.all()[0]
         self.dbsession.add(team)
         self.dbsession.commit()
         self.redirect('/admin/users')
     except ValidationError as error:
         self.render("admin/create/team.html", errors=[str(error), ])
開發者ID:AnarKyx01,項目名稱:RootTheBox,代碼行數:18,代碼來源:AdminGameObjectHandlers.py


注:本文中的models.Team.Team.motto方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。