[Zope-CMF] [dev] more add menu changes
yuppie
y.2008 at wcm-solutions.de
Fri Sep 12 04:56:52 EDT 2008
Charlie Clark wrote:
> Am 07.08.2008 um 12:26 schrieb yuppie:
>
>> Proposal 2: main_template
>> -------------------------
>>
>> CMFDefault menus are implemented in main_template. I propose to add
>> a new section for 'folder/add' actions.
>
>
> Hi yuppie,
>
> finally had a bit of time to look at this. First of all thank you very
> much for your work on this. It's a great pity your not here at the
> DZUG conference to discuss.
>
> I have an extremely basic implementation of this for the CMF:
>
> from Products.CMFCore.utils import getToolByName
>
> tt = getToolByName(context, 'portal_types')
> ti = tt.getTypeInfo(context)
>
> poss_types = ti.allowed_content_types
>
> add_forms = []
>
> for t in poss_types:
> # get type info for child
> nti = tt.getTypeInfo(t)
> if nti.add_view_expr != '':
> url = nti.add_view_expr_object
> add_forms.append({'title':nti.title, 'url':url(context)})
>
> return add_forms
I doubt that works: 'context' and expression context are not the same.
> I can't think of any other way to do this other than to call this
> expression before returning it to the template. But it's more than
> possible I've overlooked something.
Why do you want to bypass the actions machinery?
Something like that should work in main_template:
tal:define="add_forms python: actions.get('folder/add', {});"
Cheers, Yuppie
More information about the Zope-CMF
mailing list