email

class gratipay.models.participant.email.Email[source]

Participants may associate email addresses with their account.

Email addresses are stored in an emails table in the database, which holds the addresses themselves as well as info related to address verification. While a participant may have multiple email addresses on file, verified or not, only one will be the primary email address: the one also recorded in participants.email_address. It’s a bug for the primary address not to be verified, or for an address to be in participants.email_address but not also in emails.

Having a verified email is a prerequisite for certain other features on Gratipay, such as linking a PayPal account, or filing a national identity.

add_email(email)[source]

Add an email address for a participant.

This is called when adding a new email address, and when resending the verification email for an unverified email address.

Parameters:

email (unicode) – the email address to add

Returns:

None

Raises:
  • EmailAlreadyVerified – if the email is already verified for this participant
  • EmailTaken – if the email is verified for a different participant
  • TooManyEmailAddresses – if the participant already has 10 emails
  • Throttled – if the participant adds too many emails too quickly
update_email(email)[source]

Set the email address for the participant.

get_email(email)[source]

Return a record for a single email address on file for this participant.

get_emails()[source]

Return a list of all email addresses on file for this participant.

get_verified_email_addresses()[source]

Return a list of verified email addresses on file for this participant.

remove_email(address)[source]

Remove the given email address from the participant’s account. Raises CannotRemovePrimaryEmail if the address is primary. It’s a noop if the email address is not on file.

set_email_lang(accept_lang)[source]

Given a language identifier, set it for the participant as their preferred language in which to receive email.