Am Freitag, 15. April 2005 22:18 schrieb Roger Ineichen:
> Hi Florian
>
> Behalf Of Florian Lindner
>
> > Sent: Friday, April 15, 2005 6:43 PM
> > To: [EMAIL PROTECTED]
> > Cc: zope3-dev@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.

That works now, but I get a error with instruction:

htmlcode += view.index["childInfo"] <--
    
  
traceback:

  File 
"/home/florian/Desktop/zope/lib/python/CS/centershock/browser/skin/views.py", 
line 41, in getHTML
    htmlcode += view.index["childInfo"]
TypeError: unsubscriptable object

The macro is existing. See also my previous posting.

Thx,

Florian
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to