plone.directives.form @form.validator error messages

Fred van Dijk <f.van.dijk-1kr/[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <[email protected]>
Hi,

I ran into an issue with Dexterity 2.0 where I'm not sure if this a documentation, migration from 1.x to 2.x
dexterity or zope.formlib/z3c.form issue. The default example on the plone.directives.form 2.0 for adding
validators to forms is:

@form.validator(field=IMySchema['title'])
def validateTitle(value):
    if value == value.upper():
        raise schema.ValidationError(u"Please don't shout")

This will however never show "Please don't shout", but a constant error message, which has been
reported in a bug report at https://dev.plone.org/ticket/13380 in 2012. 

A solution is to use Invalid from zope.interface:  raise Invalid(u"Please don't shout")

Is this a documentation error or a bug in plone.directives.form 2.0 that can be fixed?

zope.schema.ValidationError:
	* https://pypi.python.org/pypi/plone.directives.form/2.0 
        * http://docs.plone.org/external/plone.app.dexterity/docs/reference/value-and-validator-adaptors.html

zope.interface.Invalid:
	* http://docs.plone.org/external/plone.app.dexterity/docs/advanced/validators.html
	* http://docs.plone.org/develop/addons/schema-driven-forms/customising-form-behaviour/validation.html

With kind regards,

Fred van Dijk
--
Zest - www.zestsoftware.nl
Vasteland 78
3011 BN Rotterdam
Tel: +31 (0)10 2959251


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.