[Nuxeo-tickets] [Nuxeo Repository] #1633: Widget should have at least one field.

Nuxeo Repository trac at nuxeo.com
Tue May 2 15:14:29 CEST 2006


#1633: Widget should have at least one field.
------------------------+---------------------------------------------------
       Id:  1633        |      Status:  new                     
Component:  CPSSchemas  |    Modified:  Tue May  2 15:14:29 2006
 Severity:  normal      |   Milestone:  CPS 3.4.1               
 Priority:  P1          |     Version:  unspecified             
    Owner:  fguillaume  |    Reporter:  tracguest               
------------------------+---------------------------------------------------
 Hello,

 CPS 3.4 returns an error like this when there's no field specified in the
 "Fields" property of a widget.

 ######################################################################

 File
 "/root/instances/zope2.9/innovaDes/Products/CPSSchemas/BasicWidgets.py",
 line 1133, in prepare
     datastructure[self.getWidgetId()] = bool(datamodel[self.fields[0]])
 IndexError: tuple index out of range
 >
 /root/instances/zope2.9/innovaDes/Products/CPSSchemas/BasicWidgets.py(1133)prepare()
 -> datastructure[self.getWidgetId()] = bool(datamodel[self.fields[0]])
 ######################################################################

 I propose to control the exception and raise a message, the method (for
 CPSBooleanWidget) would be:

 {{{

 def prepare(self, datastructure, **kw):
         """Prepare datastructure from datamodel."""
         datamodel = datastructure.getDataModel()
         if len(self.fields) > 0:
             datastructure[self.getWidgetId()] =
 bool(datamodel[self.fields[0]])
         else:
             raise RuntimeError("You should specify at least one field for
 the widget %s" % self.getWidgetId())
 }}}

 Thank you very much.

-- 
Ticket URL: <http://svn.nuxeo.org/trac/pub/ticket/1633>
Nuxeo Repository <http://www.cps-project.org/>
Nuxeo Repository


More information about the Nuxeo-tickets mailing list
More information about CPS: CPS project - CVS - API

Hosting: Nuxeo: Zope service provider


This list archive provided by Nuxeo, the leaders of open source ECM. Check out the Nuxeo 5 open source, standards-based ECM project.