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

Sylvain Viollon sylvain at infrae.com
Tue Nov 15 09:59:46 UTC 2011


Hello,

Op 14 nov 2011, om 22:57 heeft Àlex Magaz Graça het volgende geschreven:

> 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()

   This set the catalog as an attribute of your folder class. No events happens.
Nothing happens, except the catalog is pickled in the database.

>         self["ticketCatalog"] = self.ticketCatalog
> 

   This set the catalog as an element in your folder item. Added events are triggered,
that probably initialize the catalog itself.

   Regards,

   Sylvain,

-- 
Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands





More information about the Grok-dev mailing list