email = <VerificationResult: u'Failed'>

Signal that verifying an email address failed. = <VerificationResult: u'Redundant'>

Signal that verifying an email address was redundant. = <VerificationResult: u'Stymied'>

Signal that an email address is already verified for a different Participant. = <VerificationResult: u'Succeeded'>

Signal that email verification succeeded.


Participants may associate email addresses with their account.

Email addresses are stored in an email_addresses 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 email_addresses.

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


A boolean indicating whether there are email address verifications outstanding for this participant. Makes a db call.

start_email_verification(email, *packages)[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.



  • EmailAlreadyVerified – if the email is already verified for this participant (unless they’re claiming packages)
  • EmailTaken – if the email is verified for a different participant
  • EmailNotOnFile – if the email address is not on file for any of the packages
  • TooManyEmailAddresses – if the participant already has 10 emails
  • Throttled – if the participant adds too many emails too quickly
validate_email_verification_request(c, email, *packages)[source]

Given a cursor, email, and packages, return None or raise.

Get a link to complete an email verification workflow.

  • c (Cursor) – the cursor to use
  • email (unicode) – the email address to be verified
  • packagesPackage objects for which a successful verification will also entail verification of ownership of the package

a URL by which to complete the verification process

get_email_verification_nonce(c, email)[source]

Given a cursor and email address, return a verification nonce.

set_primary_email(email, cursor=None)[source]

Set the primary email address for the participant.

finish_email_verification(email, nonce)[source]

Given an email address and a nonce as strings, return a three-tuple:

  • a VERIFICATION_* constant;
  • a list of packages if VERIFICATION_SUCCEEDED (None otherwise), and
  • a boolean indicating whether the participant’s PayPal address was updated if applicable (None if not).
save_email_address(cursor, address)[source]

Given an email address, modify the database.

This is where we actually mark the email address as verified. Additionally, we clear out any competing claims to the same address.

get_email(address, cursor=None, and_lock=False)[source]

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

  • address (unicode) – the email address for which to get a record
  • cursor (Cursor) – a database cursor; if None, we’ll use self.db
  • and_lock – if True, we will acquire a write-lock on the email record before returning

a database record (a named tuple)


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


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


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.


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