1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
= Validation =
== LaunchpadValidationError ==
LaunchpadValidationError is the standard exception used for custom
validators upon a validation error. Rendering one is done by getting
an IWidgetInputErrorView:
>>> from lp.app.validators import (
... LaunchpadValidationError)
>>> from lp.services.webapp.servers import (
... LaunchpadTestRequest)
>>> from zope.app.form.browser.interfaces import (
... IWidgetInputErrorView)
>>> from zope.app import zapi
>>> error = LaunchpadValidationError('lp validation error')
>>> request = LaunchpadTestRequest()
>>> view = zapi.getMultiAdapter((error, request),
... IWidgetInputErrorView)
>>> IWidgetInputErrorView.providedBy(view)
True
>>> view.snippet()
u'lp validation error'
|