[Grok-dev] Re: schema.Time() ComponentLookupError wierdness...

Philipp von Weitershausen philipp at weitershausen.de
Sat Sep 15 12:32:32 EDT 2007

Sebastian Ware wrote:
> I get the wonderful...
>   ComponentLookupError: ((<zope.schema._field.Time object at 0x3480190>, 
> <zope.publisher.browser.BrowserRequest instance 
> URL=http://localhost:8081/dynasales/default/project_1/sales_desks/sales_rep_1/dashboard>), 
> <InterfaceClass zope.app.form.interfaces.IInputWidget>, u'')
> ...when I am trying to render a widget based on the following schema:
>   class ISalesAction(Interface):
>     """
>     This is actual text in a section.
>     """
>     due_date = schema.Date(title=u"Due date", required=False)
>     due_time = schema.Time(title=u"Due time", required=False)
>     type = schema.Choice(title=u"Type", values=('ToDo', 'ToCall'))
> The actual object being passed has been instantiated like this:
>   class SalesAction(grok.Model):
>     interface.implements(interfaces.ISalesAction)
>       def __init__(self):
>         self.type = None
>         self.due_date = None
>         self.due_time = None
> There is no problem with the due_date widget. As usual with comonent 
> lookup errors I am at a loss... :) Full trace bellow. When I omit the 
> "due_time" field, it all renders fine. Any ideas?

Component lookup errors aren't that hard, they usually are quite 
informative (the ones about the widgets unfortunately don't say the 
field, but you found that out already anyway).

It's trying to get an input widget for 'due_time'. There isn't one. So 
it seems Zope 3 has no default widget for zope.schema.Time. Why aren't 
you using a Datetime for this anyway?

   due = schema.Datetime(...)

> Note, the pagetemplate is called by another pagetemplate which in turn 
> is called by another pagetemplate. But I don't think this should make 
> any difference.

It doesn't.

http://worldcookery.com -- Professional Zope documentation and training

More information about the Grok-dev mailing list