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


Python TeamManipulator.createOrUpdate方法代码示例

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


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

示例1: get

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def get(self):
        df = DatafeedFms()
        teams = df.getFmsTeamList()
        TeamManipulator.createOrUpdate(teams)

        template_values = {
            "teams": teams
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/fms_team_list_get.html')
        self.response.out.write(template.render(path, template_values))
开发者ID:linuxuser0,项目名称:the-blue-alliance,代码行数:13,代码来源:datafeed_controller.py

示例2: store_team

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
def store_team(data):
    team = Team(id=data['key'])
    team.team_number = data['team_number']
    team.nickname = data['nickname']
    team.name = data['name']
    team.website = data['website']
    team.rookie_year = data['rookie_year']
    team.motto = data['motto']
    team.city = data['city']
    team.state_prov = data['state_prov']
    team.country = data['country']

    TeamManipulator.createOrUpdate(team)
    return team
开发者ID:fangeugene,项目名称:the-blue-alliance,代码行数:16,代码来源:bootstrap.py

示例3: test_create_lots_of_teams

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def test_create_lots_of_teams(self):
        number = 500
        teams = [Team(
            id = "frc%s" % team_number,
            team_number = team_number)
            for team_number in range(number)]
        TeamManipulator.createOrUpdate(teams)

        team = Team.get_by_id("frc177")
        self.assertEqual(team.key_name, "frc177")
        self.assertEqual(team.team_number, 177)

        team = Team.get_by_id("frc%s" % (number - 1))
        self.assertEqual(team.key_name, "frc%s" % (number - 1))
        self.assertEqual(team.team_number, number - 1)
开发者ID:dweitz,项目名称:the-blue-alliance,代码行数:17,代码来源:test_team_manipulator.py

示例4: get

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def get(self, key_name):
        df = DatafeedUsfirst()
        legacy_df = DatafeedUsfirstLegacy()

        team = df.getTeamDetails(Team.get_by_id(key_name))
        if not team:
            logging.warning("getTeamDetails with DatafeedUsfirst for event id {} failed. Retrying with DatafeedUsfirstLegacy.".format(key_name))
            team = legacy_df.getTeamDetails(Team.get_by_id(key_name))
        else:
            legacy_team = legacy_df.getTeamDetails(Team.get_by_id(key_name))
            if legacy_team is not None:
                team.rookie_year = legacy_team.rookie_year  # only available on legacy df

        if team:
            team = TeamManipulator.createOrUpdate(team)
            success = True
        else:
            success = False

        template_values = {
            'key_name': key_name,
            'team': team,
            'success': success,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_team_details_get.html')
        self.response.out.write(template.render(path, template_values))
开发者ID:dewdn2,项目名称:the-blue-alliance,代码行数:29,代码来源:datafeed_controller.py

示例5: get

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def get(self, year, first_eid):
        datafeed = DatafeedUsfirst()

        event = datafeed.getEventDetails(int(year), first_eid)
        event = EventManipulator.createOrUpdate(event)
        
        teams = datafeed.getEventTeams(int(year), first_eid)
        teams = TeamManipulator.createOrUpdate(teams)

        if teams:
            event_teams = [EventTeam(
                id = event.key.id() + "_" + team.key.id(),
                event = event.key,
                team = team.key,
                year = event.year)
                for team in teams]
            event_teams = EventTeamManipulator.createOrUpdate(event_teams)
        else:
            event_teams = []

        template_values = {
            'event': event,
            'event_teams': event_teams,
        }
        
        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_event_details_get.html')
        self.response.out.write(template.render(path, template_values))
开发者ID:dweitz,项目名称:the-blue-alliance,代码行数:29,代码来源:datafeed_controller.py

示例6: get

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def get(self, event_key):
        event = Event.get_by_id(event_key)
        team_ids = set()
        
        # Add teams from Matches
        for match in Match.query(Match.event == event.key).fetch(1000):
            for team in match.team_key_names:
                team_ids.add(team)
        
        teams = TeamManipulator.createOrUpdate([Team(
            id = team_id,
            team_number = int(team_id[3:]))
            for team_id in team_ids])

        if teams:
            event_teams = EventTeamManipulator.createOrUpdate([EventTeam(
                id = event_key + "_" + team.key.id(),
                event = event.key,
                team = team.key,
                year = event.year)
                for team in teams])
        else:
            event_teams = None
        
        template_values = {
            'event_teams': event_teams,
        }
        
        path = os.path.join(os.path.dirname(__file__), '../templates/math/eventteam_update_do.html')
        self.response.out.write(template.render(path, template_values))
开发者ID:germy,项目名称:the-blue-alliance,代码行数:32,代码来源:cron_controller.py

示例7: scrapeTpids

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def scrapeTpids(self, skip, year):
      """
      Searches the FIRST list of all teams for tpids, writing in the datastore.
      Also creates new Team objects.

      This code is modified from Pat Fairbank's frclinks source and modified
      to fit in the TBA framework. He has given us permission to borrow
      his code.
      """
      while 1:
        logging.info("Fetching 250 teams based on %s data, skipping %s" % (year, skip))

        tpids_dict = dict()

        # FIRST is now checking the 'Referer' header for the string 'usfirst.org'.
        # See https://github.com/patfair/frclinks/commit/051bf91d23ca0242dad5b1e471f78468173f597f
        teamList = urlfetch.fetch(self.TPID_URL_PATTERN % (year, skip), headers={'Referrer': 'usfirst.org'}, deadline=10)
        teamResults = self.teamRe.findall(teamList.content)

        for teamResult in teamResults:
          teamNumber = self.teamNumberRe.findall(teamResult)[0]
          teamTpid = self.tpidRe.findall(teamResult)[0]

          logging.info("Team %s TPID was %s in year %s." % (teamNumber, teamTpid, year))
          tpids_dict[teamNumber] = teamTpid

        teams = [Team(
              team_number=int(team_number),
              first_tpid=int(tpids_dict[team_number]),
              first_tpid_year=int(year),
              id="frc" + str(team_number)
            )
        for team_number in tpids_dict]

        TeamManipulator.createOrUpdate(teams)
        skip = int(skip) + 250

        # Handle degenerate cases.
        if skip > 10000:
          return None

        if len(self.lastPageRe.findall(teamList.content)) == 0:
          return None
开发者ID:BowlesCR,项目名称:the-blue-alliance,代码行数:45,代码来源:team_helper.py

示例8: get

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def get(self, key_name):
        # Combines data from three datafeeds with priorities:
        # 1) DatafeedFMSAPI
        # 2) DatafeedUsfirst (missing rookie year)
        # 3) DatafeedUsfirstLegacy (has all info)

        legacy_df = DatafeedUsfirstLegacy()
        usfirst_df = DatafeedUsfirst()
        fms_df = DatafeedFMSAPI('v2.0')

        # Start with lowest priority
        legacy_team = legacy_df.getTeamDetails(Team.get_by_id(key_name))
        usfirst_team = usfirst_df.getTeamDetails(Team.get_by_id(key_name))
        fms_details = fms_df.getTeamDetails(tba_config.MAX_YEAR, key_name)

        # Separate out the multiple models returned from FMSAPI call
        # Since we're only hitting one team at a time, the response won't
        # ever be paginated so we can ignore the possibility
        if fms_details and fms_details[0]:
            models, more_pages = fms_details
            fms_team, district_team, robot = models[0]
        else:
            fms_team = None
            district_team = None
            robot = None

        team = None
        if usfirst_team:
            team = TeamManipulator.updateMergeBase(usfirst_team, legacy_team)
        if fms_team:
            team = TeamManipulator.updateMergeBase(fms_team, team)

        if district_team:
            district_team = DistrictTeamManipulator.createOrUpdate(district_team)
        if robot:
            robot = RobotManipulator.createOrUpdate(robot)
        if team:
            team = TeamManipulator.createOrUpdate(team)
            success = True
        else:
            success = False
            logging.warning("getTeamDetails failed for team: {}".format(key_name))

        template_values = {
            'key_name': key_name,
            'team': team,
            'success': success,
            'district': district_team,
            'robot': robot,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_team_details_get.html')
        self.response.out.write(template.render(path, template_values))
开发者ID:arilotter,项目名称:the-blue-alliance,代码行数:55,代码来源:datafeed_controller.py

示例9: post

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def post(self, event_key_id):
        self._require_admin()
        event = Event.get_by_id(event_key_id)

        teams_csv = self.request.get('teams_csv')
        team_numbers = CSVTeamsParser.parse(teams_csv)

        event_teams = []
        teams = []
        for team_number in team_numbers:
            event_teams.append(EventTeam(id=event.key.id() + '_frc{}'.format(team_number),
                                         event=event.key,
                                         team=ndb.Key(Team, 'frc{}'.format(team_number)),
                                         year=event.year))
            teams.append(Team(id='frc{}'.format(team_number),
                              team_number=int(team_number)))

        EventTeamManipulator.createOrUpdate(event_teams)
        TeamManipulator.createOrUpdate(teams)

        self.redirect("/admin/event/" + event.key_name)
开发者ID:technonerdz,项目名称:the-blue-alliance,代码行数:23,代码来源:admin_event_controller.py

示例10: get

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def get(self, key_name):
        existing_team = Team.get_by_id(key_name)

        fms_df = DatafeedFMSAPI('v2.0')
        df2 = DatafeedFIRSTElasticSearch()
        year = datetime.date.today().year
        fms_details = fms_df.getTeamDetails(year, key_name)

        if fms_details:
            team, district_team, robot = fms_details[0]
        else:
            team = None
            district_team = None
            robot = None

        if team:
            team = TeamManipulator.mergeModels(team, df2.getTeamDetails(existing_team))
        else:
            team = df2.getTeamDetails(existing_team)

        if team:
            team = TeamManipulator.createOrUpdate(team)

        # Clean up junk district teams
        # https://www.facebook.com/groups/moardata/permalink/1310068625680096/
        dt_keys = DistrictTeam.query(
            DistrictTeam.team == existing_team.key,
            DistrictTeam.year == year).fetch(keys_only=True)
        keys_to_delete = set()
        for dt_key in dt_keys:
            if not district_team or dt_key.id() != district_team.key.id():
                keys_to_delete.add(dt_key)
        DistrictTeamManipulator.delete_keys(keys_to_delete)

        if district_team:
            district_team = DistrictTeamManipulator.createOrUpdate(district_team)

        if robot:
            robot = RobotManipulator.createOrUpdate(robot)

        template_values = {
            'key_name': key_name,
            'team': team,
            'success': team is not None,
            'district': district_team,
            'robot': robot,
        }

        if 'X-Appengine-Taskname' not in self.request.headers:  # Only write out if not in taskqueue
            path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_team_details_get.html')
            self.response.out.write(template.render(path, template_values))
开发者ID:,项目名称:,代码行数:53,代码来源:

示例11: get

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def get(self, key_name):
        # Combines data from three datafeeds with priorities:
        # 1) DatafeedFMSAPI (missing website)
        # 2) DatafeedUsfirst (missing rookie year)
        # 3) DatafeedUsfirstLegacy (has all info)

        legacy_df = DatafeedUsfirstLegacy()
        usfirst_df = DatafeedUsfirst()
        fms_df = DatafeedFMSAPI('v2.0')

        # Start with lowest priority
        legacy_team = legacy_df.getTeamDetails(Team.get_by_id(key_name))
        usfirst_team = usfirst_df.getTeamDetails(Team.get_by_id(key_name))
        fms_details = fms_df.getTeamDetails(date.today().year, key_name)

        if fms_details:
            fms_team, district_team, robot = fms_details
        else:
            fms_team = None
            district_team = None
            robot = None

        team = None
        if usfirst_team:
            team = TeamManipulator.updateMergeBase(usfirst_team, legacy_team)
        if fms_team:
            team = TeamManipulator.updateMergeBase(fms_team, team)

        if district_team:
            district_team = DistrictTeamManipulator.createOrUpdate(district_team)
        if robot:
            robot = RobotManipulator.createOrUpdate(robot)
        if team:
            team = TeamManipulator.createOrUpdate(team)
            success = True
        else:
            success = False
            logging.warning("getTeamDetails failed for team: {}".format(key_name))

        template_values = {
            'key_name': key_name,
            'team': team,
            'success': success,
            'district': district_team,
            'robot': robot,
        }

        path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_team_details_get.html')
        self.response.out.write(template.render(path, template_values))
开发者ID:RCB35,项目名称:the-blue-alliance,代码行数:51,代码来源:datafeed_controller.py

示例12: get

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def get(self, event_key):
        teams, event_teams, et_keys_to_del = EventTeamUpdater.update(event_key)

        teams = TeamManipulator.createOrUpdate(teams)

        if teams:
            event_teams = EventTeamManipulator.createOrUpdate(event_teams)

        if et_keys_to_del:
            EventTeamManipulator.delete_keys(et_keys_to_del)

        template_values = {"event_teams": event_teams, "deleted_event_teams_keys": et_keys_to_del}

        path = os.path.join(os.path.dirname(__file__), "../templates/math/eventteam_update_do.html")
        self.response.out.write(template.render(path, template_values))
开发者ID:brandondean,项目名称:the-blue-alliance,代码行数:17,代码来源:cron_controller.py

示例13: get

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def get(self, event_key):
        datafeed = DatafeedFMSAPI('v2.0', save_response=True)

        event = Event.get_by_id(event_key)
        awards = datafeed.getAwards(event)

        if event and event.remap_teams:
            EventHelper.remapteams_awards(awards, event.remap_teams)

        new_awards = AwardManipulator.createOrUpdate(awards)

        if new_awards is None:
            new_awards = []
        elif type(new_awards) != list:
            new_awards = [new_awards]

        # create EventTeams
        team_ids = set()
        for award in new_awards:
            for team in award.team_list:
                team_ids.add(team.id())
        teams = TeamManipulator.createOrUpdate([Team(
            id=team_id,
            team_number=int(team_id[3:]))
            for team_id in team_ids])
        if teams:
            if type(teams) is not list:
                teams = [teams]
            event_teams = EventTeamManipulator.createOrUpdate([EventTeam(
                id=event_key + "_" + team.key.id(),
                event=event.key,
                team=team.key,
                year=event.year)
                for team in teams])

        template_values = {
            'awards': new_awards,
        }

        if 'X-Appengine-Taskname' not in self.request.headers:  # Only write out if not in taskqueue
            path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_awards_get.html')
            self.response.out.write(template.render(path, template_values))
开发者ID:MC42,项目名称:the-blue-alliance,代码行数:44,代码来源:datafeed_controller.py

示例14: get

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def get(self, key_name):
        existing_team = Team.get_by_id(key_name)

        fms_df = DatafeedFMSAPI('v2.0')
        df2 = DatafeedFIRSTElasticSearch()
        fms_details = fms_df.getTeamDetails(datetime.date.today().year, key_name)

        if fms_details:
            team, district_team, robot = fms_details[0]
        else:
            team = None
            district_team = None
            robot = None

        if team:
            team = TeamManipulator.mergeModels(team, df2.getTeamDetails(existing_team))
        else:
            team = df2.getTeamDetails(existing_team)

        if team:
            team = TeamManipulator.createOrUpdate(team)

        if district_team:
            district_team = DistrictTeamManipulator.createOrUpdate(district_team)

        if robot:
            robot = RobotManipulator.createOrUpdate(robot)

        template_values = {
            'key_name': key_name,
            'team': team,
            'success': team is not None,
            'district': district_team,
            'robot': robot,
        }

        if 'X-Appengine-Taskname' not in self.request.headers:  # Only write out if not in taskqueue
            path = os.path.join(os.path.dirname(__file__), '../templates/datafeeds/usfirst_team_details_get.html')
            self.response.out.write(template.render(path, template_values))
开发者ID:dtbinh,项目名称:the-blue-alliance,代码行数:41,代码来源:datafeed_controller.py

示例15: resetAll

# 需要导入模块: from helpers.team_manipulator import TeamManipulator [as 别名]
# 或者: from helpers.team_manipulator.TeamManipulator import createOrUpdate [as 别名]
    def resetAll(self, flushed=False):
        response = self.testapp.get('/api/v2/events/2010', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)

        EventManipulator.createOrUpdate(self.event_2010sc_1)
        if flushed:
            self.assertEqual(memcache.get(self.eventlist_2010_cache_key), None)
        TeamManipulator.createOrUpdate(self.team_frc1_1)
        TeamManipulator.createOrUpdate(self.team_frc2_1)
        EventTeamManipulator.createOrUpdate(self.eventteam_2010sc_frc1)
        EventTeamManipulator.createOrUpdate(self.eventteam_2010sc_frc2)
        MatchManipulator.createOrUpdate(self.match1_1)
        AwardManipulator.createOrUpdate(self.award1_1)

        response = self.testapp.get('/api/v2/events/2010', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.event_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/event/2010sc', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/event/2010sc/teams', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/event/2010sc/matches', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/event/2010sc/stats', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/event/2010sc/rankings', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/event/2010sc/awards', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
        self.assertNotEqual(memcache.get(self.event_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventteams_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventmatches_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventstats_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventrankings_2010sc_cache_key), None)
        self.assertNotEqual(memcache.get(self.eventawards_2010sc_cache_key), None)
        if flushed:
            self.assertEqual(memcache.get(self.team_frc1_cache_key), None)
            self.assertEqual(memcache.get(self.team_frc2_cache_key), None)

        response = self.testapp.get('/api/v2/team/frc1/2010', headers={'X-TBA-App-Id': 'tba-tests:api-cache-clear-test:v01'})
        self.assertNotEqual(memcache.get(self.eventlist_2010_cache_key), None)
#.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:103,代码来源:


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