示例#1
0
文件: Team.py 项目: cflewis/wowspyder
 def get_team(self, name, realm, site, size=None, get_characters=False, cached=False):
     """Returns a team object. Setting get_characters to True will
     cause characters in the team to be created at the same time. This is
     slower, but likely what you will want.
     
     Setting cached to True will return the cached version of the team, 
     if you're sure it's already in the database.
     
     """
     team = self._session.query(Team).get((name, realm, site))
     
     if cached and team:
         return team
     
     if not team and not size: raise NameError("No team on that PK, " + \
         "need size to create new team.")
         
     log.debug("Getting team...")
         
     # cflewis | 2009-04-02 | If downloading fails, the whole team
     # couldn't be found, so the exception should propagate up.
     source = self._download_url(\
         WoWSpyderLib.get_team_url(name, realm, site, size))
     team = self._parse_team(StringIO.StringIO(source), site, get_characters=get_characters)
     
     return team
示例#2
0
文件: Team.py 项目: cflewis/wowspyder
 def url(self):
     return WoWSpyderLib.get_team_url(self.name, self.realm, self.site, \
             self.size)