Exemplo n.º 1
0
	def _doCreateObject(self, data):
		"""Builds the kill object using the raw data provided from the database"""
		from Model.player import Player
		player_ = Player(data["id"])

		gmapper = GameMapper()
		game_ = gmapper.find(data["game_id"])

		# If the game is deleted and the player is still linked, then errors can occur
		player_.setGame(game_)

		umapper = UserMapper()
		user_ = umapper.find(data["user_id"])

		if user_ is not None:
			player_.setUser(user_)

		player_.setName(data["name"])
		player_.setPhoto(data["photo"])
		player_.setLat(data["lat"])
		player_.setLon(data["lon"])
		player_.setScore(data["score"])
		player_.setTime(data["time"])

		return player_
Exemplo n.º 2
0
    def _doCreateObject(self, data):
        """Builds the kill object using the raw data provided from the database"""
        from Model.player import Player
        player_ = Player(data["id"])

        gmapper = GameMapper()
        game_ = gmapper.find(data["game_id"])

        # If the game is deleted and the player is still linked, then errors can occur
        player_.setGame(game_)

        umapper = UserMapper()
        user_ = umapper.find(data["user_id"])

        if user_ is not None:
            player_.setUser(user_)

        player_.setName(data["name"])
        player_.setPhoto(data["photo"])
        player_.setLat(data["lat"])
        player_.setLon(data["lon"])
        player_.setScore(data["score"])
        player_.setTime(data["time"])

        return player_