The ticket for this is: https://svn.nuxeo.org/trac/pub/ticket/1633 

Thanks.

JoseLuis de la Rosa Triviño 
Becario Área de Sistemas de Información 
FUNDACIÓN IAVANTE 
[EMAIL PROTECTED] 
Tel. 951 015 300 


Este correo electrónico y, en su caso, cualquier fichero anexo, contiene 
información confidencial exclusivamente dirigida a su(s) destinatario(s). Toda 
copia o divulgación deberá ser autorizada por IAVANTE.

This e-mail and any attachments are confidential and exclusively directed to 
its adressee(s). Any copy or distribution will have to be authorized by IAVANTE.



-----Mensaje original-----
De: Olivier Grisel [mailto:[EMAIL PROTECTED] 
Enviado el: viernes, 28 de abril de 2006 17:40
Para: [email protected]
Asunto: [CPS-devel] Re: Widget should have at least one field.

JoseLuis de la Rosa Triviño a écrit :
> 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())
> 
> ######################################################################
> 
>  

Could you please open a ticket for such feature requests?

-- 
Olivier

_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel
_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

Reply via email to