def _doPost(self, dataObject): if ( "name" in dataObject and "game" in dataObject and "respawn_code" in dataObject and "reference_code" in dataObject ): TM = TeamMapper() team = Team() try: game = GameMapper().find(dataObject["game"]["id"]) if game is None: raise NotFound("The specified game id was not found on the server.") team.setGame(game) except mdb.DatabaseError, e: raise ServerError("Unable to search the teams or players database (%s)" % e.args[1]) team.setName(dataObject["name"]) team.setRespawnCode(dataObject["respawn_code"]) team.setReferenceCode(dataObject["reference_code"]) try: TM.insert(team) except mdb.DatabaseError, e: raise ServerError("Unable to create the team in the database (%s)" % e.args[1])