def test_exceptionviews__ValidationErrorView__3(self): """It quotes HTML characters correctly.""" err = ValidationError(u"The <error> & me.") view = ValidationErrorView(err, None) self.assertEqual( view.snippet(), '<span class="error">The <error> & me.</span>')
def validate(self): """ This method used to be part of zope.formlib.interfaces.IInputWidget in Zope 3.0, but is no longer part of the interface in Zope 3.2 """ # If the user has chosen to assign this bug to somebody else, # ensure that they actually provided a valid input value for # the assignee field. option = self.request.form_ng.getOne(self.name + ".option") if option == self.assign_to: if not self.assignee_chooser_widget.hasInput(): raise WidgetInputError( self.name, self.label, ValidationError("Missing value for assignee")) if not self.assignee_chooser_widget.hasValidInput(): raise WidgetInputError(self.name, self.label, ValidationError("Assignee not found"))
def __conform__(self, iface): raise ValidationError()
def test_exceptionviews__ValidationErrorView__4(self): """It converts the exception argument of an ConversionError as well.""" err = ConversionError(ValidationError("not valid")) view = ValidationErrorView(err, None) self.assertEqual( view.snippet(), '<span class="error">not valid</span>')
def test_exceptionviews__ValidationErrorView__2(self): """It converts also unicode an html snippet.""" err = ValidationError(u"Fälscher!") view = ValidationErrorView(err, None) self.assertEqual( view.snippet(), u'<span class="error">Fälscher!</span>')
def test_exceptionviews__ValidationErrorView__1(self): """It converts an invariant error to an html snippet.""" err = ValidationError("Bad error! Bad!") view = ValidationErrorView(err, None) self.assertEqual( view.snippet(), '<span class="error">Bad error! Bad!</span>')