예제 #1
0
    def init_team(self, team):
        """Create team if not exists."""

        team_stored = Team.all().filter('name =', team['name']).get()
        if team_stored is None:
            team_stored = Team(name=team['name'])
            short_match = re.search(r'([a-z]{3})\.gif$', team['flag'])
            team_stored.flag = team['flag']
            team_stored.short = short_match.group(1)
            team_stored.href = team['href']
            team_stored.put()

        return team_stored
예제 #2
0
파일: fifa2010.py 프로젝트: xczimi/xpool
    def init_team(self, team):
        """Create team if not exists."""

        team_stored = Team.all().filter('name =',team['name']).get()
        if team_stored is None:
            team_stored = Team(name=team['name'])
            short_match = re.search(r'([a-z]{3})\.gif$',team['flag'])
            team_stored.flag = team['flag']
            team_stored.short = short_match.group(1)
            team_stored.href = team['href']
            team_stored.put()

        return team_stored
예제 #3
0
파일: uefa2012.py 프로젝트: xczimi/xpool
    def init_team(self, team):
        """Create team if not exists."""

        team_stored = Team.all().filter('name =',team['name']).get()
        if team_stored is None:
            team_stored = Team(name=team['name'])
            short_match = re.search(r'([a-z]{3})\.png$',team['flag'])
            team_stored.flag = team['flag']
            team_stored.short = short_match.group(1)
            team_stored.href = "http://www.uefa.com/" + team['href']
            team_stored.teamId = re.match(r'/uefaeuro/season=2012/teams/team=([0-9]+)/index.html', team['href']).group(1)
            team_stored.put()

        return team_stored
예제 #4
0
    def init_team(self, team):
        """Create team if not exists."""

        team_stored = Team.all().filter('name =', team['name']).get()
        if team_stored is None:
            team_stored = Team(name=team['name'])
            short_match = re.search(r'([a-z]{3})\.png$', team['flag'])
            team_stored.flag = team['flag']
            team_stored.short = short_match.group(1)
            team_stored.href = "http://www.uefa.com/" + team['href']
            team_stored.teamId = re.match(
                r'/uefaeuro/season=2012/teams/team=([0-9]+)/index.html',
                team['href']).group(1)
            team_stored.put()

        return team_stored