c.l.w._.LaunchpadFormView(LaunchpadView) : class documentation

Part of canonical.launchpad.webapp View In Hierarchy

Known subclasses: canonical.launchpad.webapp.__init__.LaunchpadEditFormView

No class docstring
Method __init__ Undocumented
Method initialize Override this in subclasses.
Method render Return the body of the response.
Method extendFields Allow subclasses to extend the form fields.
Method setUpFields Undocumented
Method setUpWidgets Set up the widgets using the view's form fields and the context.
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 initial_values Override this in your subclass if you want any widgets to have
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 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 _abort Abort the form edit.
Method _validate Check all widgets and perform any custom validation.

Inherited from LaunchpadView:

Method template The page's template, if configured in zcml.
Method __call__ Undocumented
Method _isRedirected Return True if a redirect was requested.
Method _getErrorMessage Property getter for error_message.
Method _setErrorMessage Property setter for error_message.
Method _getInfoMessage Property getter for info_message.
Method _setInfoMessage Property setter for info_message.

Inherited from UserAttributeCache (via LaunchpadView):

Method account Undocumented
Method user The logged-in Person, or None if there is no one logged in.
Method isBetaUser Return True if the user is in the beta testers team.
def __init__(self, context, request):
Undocumented
def initialize(self):
Override this in subclasses.

Default implementation does nothing.

def render(self):
Return the body of the response.

By default, this method will execute the template attribute to render the content. But if an action handler was executed and it returned a value other than None, that value will be used as the rendered content.

See LaunchpadView.render() for other information.

def _abort(self):
Abort the form edit.

This will be called in the case of a validation error.

def extendFields(self):
Allow subclasses to extend the form fields.
def setUpFields(self):
Undocumented
def setUpWidgets(self, context=None):
Set up the widgets using the view's form fields and the context.

If no context is given, the view's context is used.

@property
def adapters(self):
Provide custom adapters for use when setting up the widgets.
@property
def action_url(self):
Set the default action URL for the form.
@property
def has_available_actions(self):
Does the view have any available actions that will render?

If False is returned, the view or template probably needs to explain why no actions can be performed and offer a cancel link.

@property
def initial_values(self):
Override this in your subclass if you want any widgets to have initial values.
def addError(self, message):
Add a form wide error.

The 'message' parameter is CGI-escaped in accordance with the INotificationResponse.addNotification() API. Please see it for details re: internationalized and markup text.

def getFieldError(self, field_name):
Get the error associated with a particular field.

If an error message is available in widget_errors, it is returned. As a fallback, the corresponding widget's error() method is called.

def setFieldError(self, field_name, message):
Set the error associated with a particular field.

If the validator for the field also flagged an error, the message passed to this method will be used in preference.

The 'message' parameter is CGI-escaped in accordance with the INotificationResponse.addNotification() API. Please see it for details re: internationalized and markup text.

@staticmethod
def validate_none(form, action, data):
Do not do any validation.

This is to be used in subclasses that have actions in which no validation is wanted (e.g. a cancel action).

def validate_widgets(self, data, names=None):
Validate the named form widgets.
ParametersnamesNames of widgets to validate. If None, all widgets will be validated.
def _validate(self, action, data):
Check all widgets and perform any custom validation.
@property
def error_count(self):
Undocumented
def validate(self, data):
Validate the form.

For each error encountered, the addError() method should be called to log the problem.

def validate_cancel(self, action, data):
Noop validation in case we cancel.

You can use this in your Form views by simply setting validator='validate_cancel' in the @action line of your cancel button.

def focusedElementScript(self):
Helper function to construct the script element content.
def isSingleLineLayout(self, field_name):
Undocumented
def isMultiLineLayout(self, field_name):
Undocumented
def isCheckBoxLayout(self, field_name):
Undocumented
def showOptionalMarker(self, field_name):
Should the (Optional) marker be shown?
API Documentation for Launchpad, generated by pydoctor at 2010-09-27 00:00:11.