Ejemplo n.º 1
0
    def _create_credentials(self, raw_user, league_id=None, inviter_id=None):
        """ Create a new User and Player from raw user credentials. """

        # TODO: there are a lot of open questions here:
        # 1/ maybe fix this parameter list...it's ridiculous!
        # 2/ what about when we want to create a Person who isn't a Player?
        # 3/ when other credentialing options exist, it might not be good to
        #    assume exclusively.
        # 4/ is it more sensible to keep these methods separate if it turns out
        #    we can't easily generalize across other Person subclasses?
        (user, player) = User.create_user_and_player(
            PROPERTY_VALUE.EMPTY,
            PROPERTY_VALUE.EMPTY,
            None,
            PROPERTY_VALUE.EMPTY,
            PROPERTY_VALUE.EMPTY,
            {THIRD_PARTY.FACEBOOK: raw_user},
            inviter_id,
            self._ip,
            self._locale,
        )

        # TODO: uncomment TAGGED SqEdge type and pass optional third argument.
        if league_id is not None:
            Person.join_league(player.id, league_id)

        return (user, player)