[Zope-CMF] Customising types with add views

Martin Aspeli optilude at gmx.net
Mon Dec 8 10:20:02 EST 2008


Hi,

Currently, we have this situation (on trunk):

  - Add views are looked up by evaluating the FTI add_view_expr

  - The default/conventional add_view_expr is

     string:${folder_url}/++add++<typename>

  - This will look for an adapter (context, request, fti) with name = 
fti.factory and return that as the add view

Let's consider a type Alpha that has a custom add form registered as 
such a (context, request, fti) adapter with name "Alpha". fti.factory is 
"Alpha", and there's a corresponding IFactory utility (with name "Alpha").

Now, let's say I want to create a new type Beta (e.g. by copying the FTI 
object TTW), based on Alpha. I want this to use Alpha's add form, but 
construct objects with portal_type Beta.

Is this possible? If I set Beta's fti.factory to be something other than 
"Alpha", then it won't find the add view, but if fti.factory is "Alpha" 
then the objects constructed will use Alpha's factory.

I can't quite decide whether this is a problem in real life or not, 
although it does seem a bit strange that the add view adapter name and 
the factory utility name have to be the same.

Would it make sense to decouple these, e.g. with a new "add_view_name" 
property?

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the Zope-CMF mailing list