def _doGet(self): TM = TeamMapper() if self.arg is not None and self.arg.isdigit(): try: # Get the team by ID team = TM.find(self.arg) except mdb.DatabaseError, e: raise ServerError("Unable to search the team database (%s: %s)" % e.args[0], e.args[1]) if team is None: raise NotFound("This team does not exist") rdata = { "score": team.getScore() } return self._response(rdata, CODE.OK)
def _doGet(self): try: TM = TeamMapper() if self.arg is not None: if self.arg.isdigit(): # Get the user by ID team = TM.find(self.arg) else: raise BadRequest("Teams must be requested by ID") if team is not None: return self._response(Depth.build(team, self.depth), CODE.OK) else: raise NotFound("There is no team identified by the number %s" % self.arg) except mdb.DatabaseError, e: raise ServerError("Unable to search the game database (%s: %s)" % e.args[0], e.args[1])