[Zope3-Users] using filter in addMenuItem
Ivan Horvath
pillesoft at gmail.com
Tue Apr 3 04:09:47 EDT 2007
Dear Christophe,
thank you for your answer, you're right, this way i get the container
object. additionally permission needs to be added for this method.
only one question remained unanswered. as i recognized zope3 collects
always all addmenu items. this i assume, because the traversal
exception raised for the objects where i didn't specify any filter in
the addMenuItem. that means zope3 tries to check the filter expression
for all container objects.
i don't really understand why it is in this way. is it possible to
specify a certain object where isNeedtoDisplay should be queried, or
should i use a kind of sub classing solution?
On 4/2/07, Christophe Combelles <ccomb at free.fr> wrote:
> I think the context of an adding view is an object providing IAdding. The
> context of the context might be the container of your object.
> Try to set isNeedtoDisplay as the container's method, and maybe
> "context/context/isNeedtoDisplay" as your filter.
>
> Christophe
>
> Ivan Horvath a écrit :
> > Dear All,
> >
> > it seems that i have to use filter attribute in browser:addMenuItem
> > directive. i couldn't find any usable help how to use it, and my
> > trials are failed so far.
> >
> > this is the menu declaration in zcml:
> > <browser:addMenuItem
> > title="Article"
> > factory="fa.Article"
> > view="addArticle.html"
> > filter="context/isNeedtoDisplay"
> > permission="zope.ManageContent"
> > />
> >
> > <browser:page
> > for="zope.app.container.interfaces.IAdding"
> > name="addArticle.html"
> > class=".helper.ArticleAddForm"
> > permission="zope.ManageContent"
> > />
> >
> > i receive always a TraversalError exception. i don't know where shall
> > i put the isNeedtoDisplay method.
> > File "D:\alco\zope\src\zope\traversing\adapters.py", line 52, in traverse
> > raise TraversalError(subject, name)
> > - __traceback_info__: (<zope.app.publisher.browser.viewmeta.+ object
> > at 0x02D
> > E9D90>, 'isNeedtoDisplay', [])
> > TraversalError: (<zope.app.publisher.browser.viewmeta.+ object at
> > 0x02DE9D90>, '
> > isNeedtoDisplay')
> >
> > thanks in advance
> >
> > Ivan
> > _______________________________________________
> > Zope3-users mailing list
> > Zope3-users at zope.org
> > http://mail.zope.org/mailman/listinfo/zope3-users
> >
> >
>
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
More information about the Zope3-users
mailing list