[Zope-CMF] CMF 2.2.0-beta reminder

yuppie y.2009 at wcm-solutions.de
Wed Dec 2 14:51:09 EST 2009


Hi Charlie!


Charlie Clark wrote:
> Hooking everything together is, however, a bit clunky:
> 
>      <adapter
>          name="myproduct.content_type_factory"
>          factory=".myproduct.MyAddView"
>          />
> 
>      <class class=".myproduct.MyAddView">
>        <require
>            permission="cmf.AddPortalContent"
>            interface="zope.formlib.interfaces.IPageForm"
>            />
>      </class>
> 
> For the sake of clarity it would be nice to have a directive that ties  
> this together. Particularly the juxtaposition of the adapter name (which  
> has to be the same as the named content type factory utility) and the view  
> acting as a factory is a definite possible source of confusion. And, while  
> I much prefer the security declaration outside of the view class, the  
> combination is a bit unintuitive.
> 
> I would find something like:
> 
> <cmf:addView
> 	factory="myproduct.content_type_factory"
> 	class=".myproduct.MyAddView"
> 	permission="cmf.AddPortalContent"
> 	required-inteface="zope.formlib.interfaces.IPageForm"
> />
> 
> easier to work with.

-1

The real issue here is the fact that the permission argument of the 
adapter directive is not supported in Zope 2. Otherwise we could simply 
use this:

      <adapter
          name="myproduct.content_type_factory"
          factory=".myproduct.MyAddView"
          permission="cmf.AddPortalContent"
          />

Using the class directive instead is just a workaround for a generic 
problem that needs a generic solution, not a new addView directive.

> I'm also not sure if the add view URL couldn't be simpler because the  
> ++add++ContentTypeId is a must, why this can't be interpolated either on  
> type registration or in the add_action look-up. Is there any reason why  
> this couldn't or shouldn't be the case?

We need a prefix to make sure there are no conflicts with existing names 
and we need something in the name that specifies the portal type. The ++ 
around the prefix indicates that it is implemented as traverser.

I currently use method aliases defined for the container to customize 
the names shown in the URL. But that's not perfect because you can't 
define the aliases together with the portal type and you have to define 
them for each container type used.

If you have a better idea, please let me know.

> Having finally taken the plunge into buildout I've been able to upgrade  
> one of our projects onto Zope 2.12 and CMF 2.2 with no real problems just  
> the odd "surprise". Thank you all very much for your help with Zope + CMF!

Thanks for testing and feedback!


Cheers,

	Yuppie



More information about the Zope-CMF mailing list