[Grok-dev] getUtility(ICatalog) fails with ComponentLookupError

Àlex Magaz Graça rivaldi8 at gmail.com
Mon Nov 14 21:57:01 UTC 2011


Hi! I finally got it right. The problem was in the following snipped:

> [...]
> class Helpdesk(grok.Application, grok.Container):
>     def __init__(self):
>         super(Helpdesk, self).__init__()
>         self.ticketCatalog = TicketCatalog()
>

Adding the TicketCatalog object to the Helpdesk container like below 
solved the problem:

def __init__(self):
         super(Helpdesk, self).__init__()
         self.ticketCatalog = TicketCatalog()
         self["ticketCatalog"] = self.ticketCatalog

It also solved a problem with the ticket indexes not being updated 
automatically. This fix looks a bit weird to me, though.
I guess I should structure the code in way that fits better with Grok...

Cheers,
Àlex



More information about the Grok-dev mailing list