Using viewlets (and views) in third-party products

Alex Clark aclark at aclark.net
Fri Aug 31 02:36:27 UTC 2007


On 2007-08-26, Martin Aspeli <optilude at gmx.net> wrote:
> The problem is that if we have a third party product that wants to 
> install, say, a tagging viewlet, but only have this show up on sites 
> where it's actually installed, then that product can't define a brand 
> new theme (since only one theme is active at a time). It *could* of 
> course render the viewlet conditionally (if I'm not installed, render 
> the viewlet as a blank), but that'd be cumbersome and silly.

So basically, if I install a theme package in site foo, bar will get
foo's viewlets (where foo and bar are in the same zope instance) ? 
If not, then I don't understand :-p

> I'm proposing to write a small package that people can depend on (using 
> egg dependencies, so it'd be automatic, at least for egg-distributed 
> packages), that we can push into Plone core either with 3.5 or before, 
> if Wichert agrees (the only reason would be developer convenience). It 
> would work like this:
>   - The third party product author creates a new 'layer' interface
>   - Views and viewlets in this product are registered for this 'layer'
>   - A GenericSetup XML file is used to register the 'layer' interface 
> with some site-local utility (or possibly to register the layer 
> interface itself as a local utility, but that'd just be an 
> implementation detail)
>   - A pre-traversal hook like the one in plone.theme looks up all 
> installed layers and applies them to the request. The product author 
> wouldn't need to do anything special here.
> We'd need a sane way to uninstall as well, but that's about it. Note 
> that this is orthogonal to what plone.theme does, although the two could 
> be unified. Thus, another option would be to extend plone.theme to 
> handle this use case, but then we'd need to either add this to Plone 
> 3.0.1 or have an optional dependency in a higher version of plone.theme, 
> which could cause some confusion (e.g. with plone.recipe.plone, which 
> pegs to specific versions).
> Does this sound sensible?

I'll wait until I understand the problem more before commenting ;-)

> Cheers,
> Martin
>


-- 
Alex Clark (http://aclark.net)





More information about the Product-Developers mailing list