l.r.b.p.PersonEditEmailsView(LaunchpadFormView) : class documentation

Part of lp.registry.browser.person View In Hierarchy

A view for editing a person's email settings.

The user can associate emails with their account, verify emails the system associated with their account, and remove associated emails.

Method initialize Undocumented
Method setUpFields Set up fields for this view.
Method initial_values Set up default values for the radio widgets.
Method validated_addresses All of this person's validated email addresses, including
Method unvalidated_addresses All of this person's unvalidated and guessed emails.
Method validate_action_remove_validated Make sure the user selected an email address to remove.
Method action_remove_validated Delete the selected (validated) email address.
Method validate_action_set_preferred Make sure the user selected an address.
Method action_set_preferred Set the selected email as preferred for the person in context.
Method validate_action_confirm Make sure the user selected an email address to confirm.
Method action_confirm Mail a validation URL to the selected email address.
Method validate_action_remove_unvalidated Make sure the user selected an email address to remove.
Method action_remove_unvalidated Delete the selected (un-validated) email address.
Method validate_action_add_email Make sure the user entered a valid email address.
Method action_add_email Register a new email for the person in context.
Method _validated_emails_field Create a field with a vocabulary of validated emails.
Method _unvalidated_emails_field Create a field with a vocabulary of unvalidated and guessed emails.
Method _validate_selected_address A generic validator for this view's actions.

Inherited from LaunchpadFormView:

Method __init__ Undocumented
Method render Return the body of the response.
Method extendFields Allow subclasses to extend the form fields.
Method setUpWidgets Set up the widgets using the view's form fields and the context.
Method help_links Dictionary mapping field names to help links.
Method adapters Provide custom adapters for use when setting up the widgets.
Method action_url Set the default action URL for the form.
Method has_available_actions Does the view have any available actions that will render?
Method addError Add a form wide error.
Method getFieldError Get the error associated with a particular field.
Method setFieldError Set the error associated with a particular field.
Static Method validate_none Do not do any validation.
Method validate_widgets Validate the named form widgets.
Method error_count Undocumented
Method ajax_failure_handler Called by the form if validate() finds any errors.
Method validate Validate the form.
Method validate_cancel Noop validation in case we cancel.
Method focusedElementScript Helper function to construct the script element content.
Method isSingleLineLayout Undocumented
Method isMultiLineLayout Undocumented
Method isCheckBoxLayout Undocumented
Method showOptionalMarker Should the (Optional) marker be shown?
Method _processNotifications Add any notification messages to the response headers.
Method _abort Abort the form edit.
Method _validate Check all widgets and perform any custom validation.
def initialize(self):
Undocumented
def setUpFields(self):
Set up fields for this view.

The main fields of interest are the selection fields with custom vocabularies for the lists of validated and unvalidated email addresses.

@property
def initial_values(self):
Set up default values for the radio widgets.

A radio widget must have a selected value, so we select the first unvalidated and validated email addresses in the lists to be the default for the corresponding widgets.

The only exception is if the user has a preferred email address: then, that address is used as the default validated email address.

def _validated_emails_field(self):
Create a field with a vocabulary of validated emails.
ReturnsA Choice field containing the list of validated emails
def _unvalidated_emails_field(self):
Create a field with a vocabulary of unvalidated and guessed emails.
ReturnsA Choice field containing the list of emails
def _validate_selected_address(self, data, field='VALIDATED_SELECTED'):
A generic validator for this view's actions.

Makes sure one (and only one) email address is selected and that the selected address belongs to the context person. The address may be represented by an EmailAddress object or (for unvalidated addresses) a LoginToken object.

@property
def validated_addresses(self):
All of this person's validated email addresses, including their preferred address (if any).
@property
def unvalidated_addresses(self):
All of this person's unvalidated and guessed emails.

The guessed emails will be EmailAddress objects, and the unvalidated emails will be unicode strings.

def validate_action_remove_validated(self, action, data):
Make sure the user selected an email address to remove.
@action(_('Remove'), 'remove_validated', validate_action_remove_validated)
def action_remove_validated(self, action, data):
Delete the selected (validated) email address.
def validate_action_set_preferred(self, action, data):
Make sure the user selected an address.
@action(_('Set as Contact Address'), 'set_preferred', validate_action_set_preferred)
def action_set_preferred(self, action, data):
Set the selected email as preferred for the person in context.
def validate_action_confirm(self, action, data):
Make sure the user selected an email address to confirm.
@action(_('Confirm'), 'validate', validate_action_confirm)
def action_confirm(self, action, data):
Mail a validation URL to the selected email address.
def validate_action_remove_unvalidated(self, action, data):
Make sure the user selected an email address to remove.
@action(_('Remove'), 'remove_unvalidated', validate_action_remove_unvalidated)
def action_remove_unvalidated(self, action, data):
Delete the selected (un-validated) email address.

This selected address can be either on the EmailAddress table marked with status NEW, or in the LoginToken table.

def validate_action_add_email(self, action, data):
Make sure the user entered a valid email address.

The email address must be syntactically valid and must not already be in use.

@action(_('Add'), 'add_email', validate_action_add_email)
def action_add_email(self, action, data):
Register a new email for the person in context.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.