[Zope-CMF] IndexableObjectWrapper
Miles
miles at jamkit.com
Fri Mar 13 08:42:07 EDT 2009
Hi,
Good point about the Zope version.
>> However, one thing that I'd like an opinion on is whether it's useful to
>> move the handling of workflow variables out of catalog_object and into
>> the IndexableObjectWrapper class? To my mind it seems cleaner to move
>> it, but I'm not sure on the BBB impact.
>
> +1
>
> I can't see any additional BBB issues. Who ever uses a customized
> IndexableObjectWrapper uses also a customized catalog_object method.
>
>
> I'm still not sure if we should just adapt the object or also the portal
> or the catalog:
>
> Registering different adapters for different portals doesn't make much
> sense to me. If you need portal specific behavior you can register local
> adapters. Registering different adapters for different kinds of catalogs
> might be more useful and while 'portal' is a CMF specific concept the
> catalog itself exists always.
>
> The other reason for adapting portal or catalog is that we want to use
> them inside the adapter. We need some kind of context for looking up
> stuff like workflow variables. But do we need the portal, the context of
> the catalog or the context of the object? If the context of the object
> is sufficient, we don't need a multi-adapter. If we just need the
> catalog and its context, we still have a generic solution for Zope 2. If
> we need the portal, we have a CMF-specific solution.
My thinking was that, from a given object, we can always get the portal
(or indeed whatever object the wrapper needs). Local adapters is the
normal route for portal-specific behaviour, so we should stick to that
to keep everything in one place.
Using a multi-adapter, and adapting the catalog would appear to be
sensible - and as you say, could be generic for zope 2 in future. In
some sites, I've derived from catalog so as to use the
allowedRolesAndUsers and date filtering behaviours in other catalogs
within the portal. So I can definitely see a use-case for it.
So +1 from me to a multi-adapter on (object, catalog).
Miles
More information about the Zope-CMF
mailing list