[Zope3-Users] Re: Readout content/factory/title

Florian Lindner mailinglists at xgm.de
Fri Mar 11 08:21:57 EST 2005


Am Donnerstag, 10. März 2005 13:17 schrieb Philipp von Weitershausen:
> Florian Lindner wrote:
> > Am Dienstag, 8. März 2005 21:59 schrieb Stephan Richter:
> >>On Tuesday 08 March 2005 11:50, Florian Lindner wrote:
> >>>ow can I read out ZCML: content->factory->title of a given object? In
> >>> ZPT and Python?
> >>
> >>I do not understand this question.
> >
> > I register a content object with:
> >
> > <content class="...">
> >   [...]
> >   <factory title="The title I want to read out" />
> >   [...]
> > </content>
>
> What do you mean by "read out"?

Get the value of the title attribute.

> > The apidoc describes the attribute as:
> >
> > Text suitable for use in the 'add content' menu of a management interface
>
> This is old documentation. We register menu items in the 'add' menu with
> browser:addMenuItem now. It requires the `title` attribute, even when
> you specify a factory:
>
> <browser:addMenuItem
>      title="The label that'll appear in the menu"
>      factory="explicit.factory.id-or-dotted.name.of.the.class"
>      />

How can I use this addMenu in one of my templates? I've tried 
tal:repeat="navItem context/@@view_get_menu/add_content" and 
tal:repeat="navItem context/@@view_get_menu/zope.app.container.add"
Both returned always a empty list.

I've used the ZPT as a template of a auto generated view of the contents of a 
standard folder.

The zmi_actions menu, used as cross-check returns the excepted items.

I've a working addForm in the same layer like the template:

    <addform
        label="Add CSLink"
        title="Adds a CSLink"
        name="AddCSLink.html"
        schema="CS.Linklist.interfaces.ILink"
        content_factory="CS.Linklist.link.Link"
        permission="zope.Public"
        layer="centershock"
        menu="navMenu"
    />
    
and a addMenuItem

    <addMenuItem
        title="The label that'll appear in the menu"
        view="AddCSLink.html"
        permission="zope.Public" />

I've also rights too add objects.
    
Why can I specify a menu attribute in the addform directive but not in the 
addMenuItem?

I also don't want to have all objects that can be added to a folder but only 
certain objects. Is there any possibility to constrain this, for example 
based on the python path?

Thanks,

Florian


More information about the Zope3-users mailing list