[Zope3-dev] RE: [Zope3-Users] page uses foreignview:contextchanged

Roger Ineichen dev at projekt01.ch
Fri Apr 15 16:18:27 EDT 2005


Hi Florian 

Behalf Of Florian Lindner
> Sent: Friday, April 15, 2005 6:43 PM
> To: dev at projekt01.ch
> Cc: zope3-dev at zope.org
> Subject: Re: [Zope3-dev] RE: [Zope3-Users] page uses 
> foreignview:contextchanged
> 
> Am Mittwoch, 13. April 2005 16:16 schrieb Roger Ineichen:
> 
> > > One more question: How can I use only a specific macro of 
> the view?
> >
> > try this:
> >
> > def __init__(self, context, request):
> >   self.context = context
> >   self.request = request
> >
> > def getMacro(self):
> >
> >   macrocode = ""
> >   # get the childs of folder 'f'
> >   childs = self.context.values()
> >
> >   for item in childs:
> >
> >     # get the 'childView' for each item
> >     view = zapi.getMultiAdapter((self.context, item), 
> name='childView')

Ups, that's not correct. If the item has a view called 
"childView", then you can use:

view = zapi.getMultiAdapter((item, self.request), name="childView")

This uses the item as the context and together with the request
you can lookup for views (named adapters on context and requests).

The item I guess is a Link object? Right?

Sorry about my wrong sample.

Regards
Roger Ineichen



More information about the Zope3-dev mailing list