[Product-Developers] Re: Adapters for cataloged objects

Taito Horiuchi taito.horiuchi at gmail.com
Thu Jun 18 18:48:53 UTC 2009


Thanks Martin,

I was talking about waking up a few objects to less than 100 objects from
zodb,
so getObject() method may be the right choice.

I considered using IZCatalogBrain, but as you mentioned, brains don't give
underlying object's implementation, so I rejected to use this in my use
case.

Thanks,

Taito


On Thu, Jun 18, 2009 at 9:27 PM, Martin Aspeli
<optilude+lists at gmail.com<optilude%2Blists at gmail.com>
> wrote:

> Taito Horiuchi wrote:
>
>> Hi All,
>>
>> Can somebody tell me what is the best practice to adapts adapters to
>> cataloged objects?
>>
>> For example, I have ATDocument cataloged as
>> Products.ZCatalog.Catalog.mybrains object.
>>
>> I have adapter MyAdapter which adapts ATDocument and provide IMyAdapter.
>>
>> To Adapt this cataloged object, I need to wake it up by using getObject()
>> method like:
>>
>> IMyAdapter(cataloged_object.getObject())
>>
>> Waking up object from zodb is not good practice so, I wonder how you guys
>> do this better.
>>
>
> ... and I forgot to add: you can always use a different adapter that adapts
> IZCatalogBrain or whatever it is (see the ZCatalog code) and provides your
> interface. This then needs to be able to do all its work with the
> information on the catalog brain (or wake up the object).
>
> However, you can't get a *different* adapter depending on what the
> underlying object was when it was cataloged. All brains are created equal.
>
>
> Martin
>
> --
> Author of `Professional Plone Development`, a book for developers who
> want to work with Plone. See http://martinaspeli.net/plone-book
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20090618/20e4f5f0/attachment.html>


More information about the Product-Developers mailing list