Players — SoL 3 developers documentation

### Navigation

- index
- modules |
- next |
- previous |
- Dev's documentation »
- SoL modules »
- `sol.models` – SQLAlchemy modelization »

# Players

class `sol.models.player.` `Player`(**kwargs)

  A single person.

  `birthdate`

    Date of birth of the player.

  `caption`(html=None, localized=True)

    Description of the player, made up concatenating his names.

  classmethod `check_insert`(klass, session, fields)

    Prevent duplicated players

  `check_password`(raw_password)

    Check the password

    Parameters: | raw_password – the raw password, in clear
    Return type: | boolean

    Return `True` if the raw_password matches the user’s password, `False` otherwise.

  `check_update`(fields)

    Perform any check before updating the instance

  `citizenship`

    Whether the player belongs legally to the given country or not.

  `crypt` = <cryptacular.bcrypt.BCRYPTPasswordManager object at 0x7fe428d8d710>

    The crypt engine used for the password field

  `delete`()

    Prevent deletion if this player is involved in some tourney.

  `description`

    Description of the player, made up concatenating his names.

  `email`

    Email address of the player.

  classmethod `find`(klass, session, lastname, firstname, nickname='', guid=None)

    Find a player, even after it has been merged into another.

    Parameters: | session – an SQLAlchemy session lastname – a string, the last name of the player firstname – a string, the first name of the player nickname – a string, the nick name of the player guid – the hex string of an UUID
    Return type: | a tuple

    This tries to find the given player by looking for it first in the `players` table then in the `merged_players` table, either by guid or by name.

    If found, it returns a tuple with the current player (that is, the eventual target of the merge) and a boolean flag, `False` when it is current or `True` if it has been merged.

    If not found it returns a `(None, False)` tuple.

  `firstname`

    Player’s first name.

  `idclub`

    Membership club’s ID.

  `idfederation`

    Membership federation’s ID.

  `idowner`

    ID of the user that is responsible of this record.

  `idplayer`

    Primary key.

  `language`

    The ISO code of the preferred language of the player.

  `lastname`

    Player’s last name.

  `matchesSummary`()

    Return the number of win, lost and ties matches.

  `mergePlayers`(other_players)

    Merge multiple players into a single one.

    Parameters: | other_players – a sequence of players ids or guids, or tuples like `(guid, lastname, firstname, nickname)`
    Return type: | a list of replaced players descriptions

    This will replace the specified players with this one wherever they partecipated to a game, either in singles or team events.

    This is obviously possible only when the specified players didn’t play together in any tourney.

    The old names are stored in the table `merged_players` with a reference to the current player (that is, self), so that they can be correctly resolved in the future.

  `merged`

    A possibly empty list of `MergedPlayer` that has been merged into this one.

  `nationality`

    ISO country code to compute national rankings.

  `nickname`

    Player’s nickname, used also for login purposes.

  `owner`

    The owner of this record, admin when `None`.

  `partecipations`()

    Return the list of Competitors involving this player.

  `phone`

    Phone number of the player.

  `portrait`

    Picture of the player, used by lit.

    This is just the filename, referencing a picture inside the `sol.portraits_dir` directory.

  `serialize`(serializer)

    Reduce a single player to a simple dictionary

  `sex`

    To compute different championship: `F` means female, `M` means male.

  `shouldOmitNickName`()

    Determine if the nickname should be omitted because redundant.

### Navigation

- index
- modules |
- next |
- previous |
- Dev's documentation »
- SoL modules »
- `sol.models` – SQLAlchemy modelization »