Pilot Record

Represents a single record in the Startkladde people table, which contains one record for each known pilot.

Interface

class pysk.db.model.Pilot(id=None, last_name=None, first_name=None, club=None, nickname=None, club_id=None, comments=None, medical_validity=None, check_medical_validity=None)

Pilot representation used in Startkladde Database

Parameters:
  • id (int) – ID of this record in people table.
  • last_name (str) – Pilot last name.
  • first_name (str) – Pilot first name.
  • club (str) – Name of Club.
  • nickname (str) – Pilot nickname.
  • club_id (int) – ID of club (deprecated).
  • comments (str) – Comments field.
  • medical_validity – :class:datetime object holding expiration date of medical
  • check_medical_validity (int) – Shall Startkladde warn if medical is expired ? Use 1 for yes and 0 for no.
__eq__(other)

Equal comparison

Two pilots are defined equal, if and only if their first and last names are equal.

Parameters:other (Pilot) – Other instance to compare to
Returns:True if and only if self and other are equal.
__hash__()

Hash for object.

Returns:(self.last_name, self.first_name).__hash__
__lt__(other)

Less comparison by last name and first name

Parameters:other (Pilot) – Other instance to compare to
Returns:True if and only if self is less than other.
__str__()

Convert instance to string

Returns:last_name, first_name
generateUsername()

Generate default user name of the form ‘first_name.last_name

Returns:Username as string (all lowercase without special characters)
getCommentField(key)

Gets field from comment.

Comment fields are strings of the format ‘key = value

Parameters:key (str) – Name of key to retrieve
Returns:value associated with key or None if key does not exist.
static getMail(pilot)

Retrieve email address from Pilot object

The email is stored as comment field with key email.

Parameters:pilot (Pilot) – Object to extract mail from
Returns:String containing pilot’s email
setCommentField(key, value)

Set comment field.

Comment fields are strings of the format ‘key = value

Parameters:
  • key (str) – Name of key to set
  • value (str) – Value string. If None, the key value pair is removed, if it exists.
static tableName()

Get name of MySQL table, where this data type is used

Returns:people