Re: bug in validation of SelectWidget
Georges Racinet <[email protected]>
| Newsgroups | gmane.comp.web.zope.cps.devel |
|---|---|
| Message-ID | <[email protected]> |
On Dec 14, 2006, at 5:04 PM, Miguel Sánchez Beato wrote: > Hello people. > I'm Miguel Sánchez and I'm dealing with CPS 3.4.2. I have found a > small > bug in the product CPSSchemas: > > * When you are using a Select Widget in a layout, and you do not > select > the 'required field' option for this widget (that is, you want the > select widget to be optional), the validation of the widget (method > 'validate' of the class 'SelectWidget' from the 'BasicWidgets.py' > module) raise an error (cpsschemas_err_select) because it doesn't find > the "selected" value in the vocabulary of the widget, but...I haven't > select any value! it's an optional field! > > * This is the code: > > ... > if not vocabulary.has_key(value): > datastructure.setError(widget_id, "cpsschemas_err_select") > ... > > * So I fixed it (I think so) writing this: > > ... > if self.is_required and not vocabulary.has_key(value): > datastructure.setError(widget_id, "cpsschemas_err_select") > ... Hi, as far as I can tell, there's Generic Select Widget that accepts empty keys even if they aren't in vocabulary. Or you can use the (new) properties of Select Widget to add empty keys on the fly to the vocabulary. > > I don't know whether this bug has been already fixed or not, so if > someone could say something about it, it would help. If it hasn't been > fixed yet, I'll create a ticket in the nuxeo trac as 'tracguest'. > > Thank you! > _______________________________________________ > cps-devel mailing list > http://lists.nuxeo.com/mailman/listinfo/cps-devel > --------- Georges Racinet, Nuxeo SAS Open Source Enterprise Content Management (ECM) Web: http://www.nuxeo.com/ and http://www.nuxeo.org/ - Tel: +33 1 40 33 79 87 _______________________________________________ cps-devel mailing list http://lists.nuxeo.com/mailman/listinfo/cps-devel