l.a.v.LaunchpadValidationError(ValidationError) : interface documentation

Part of lp.app.validators View In Hierarchy

Known subclasses: lp.bugs.errors.InvalidDuplicateValue, lp.registry.interfaces.product.InvalidProductName, lp.services.identity.interfaces.account.AccountStatusError

A LaunchpadValidationError may be raised from a schema field validation method.

It is used return a meaningful error message to the user. The message may contain XHTML markup suitable for inclusion in an inline tag such as <span>.

>>> LaunchpadValidationError('<br/>oops').snippet()
u'&lt;br/&gt;oops'
>>> from lp.services.webapp.escaping import structured
>>> LaunchpadValidationError(
...     structured('<a title="%s">Ok</a>', '<evil/>')).snippet()
u'<a title="&lt;evil/&gt;">Ok</a>'
Method __init__ Create a LaunchpadValidationError instance.
Method snippet Render as an HTML error message, as per IWidgetInputErrorView.
Method doc Some code expect the error message being rendered by this
def __init__(self, message, already_escaped=False):
Create a LaunchpadValidationError instance.

message should be an HTML quoted string. Extra arguments will be HTML quoted and merged into the message using standard Python string interpolation.

def snippet(self):
Render as an HTML error message, as per IWidgetInputErrorView.
def doc(self):
Some code expect the error message being rendered by this method.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.