[Grok-dev] returning the contents of a page template in a method

Sebastian Ware sebastian at urbantalk.se
Mon Nov 5 09:51:30 EST 2007

 From a pagetemplate, you could call it like this:

   <tal:block replace="structure view/the_object/@@myappform" />

Where self.the_object is set in the update() method of the view class.

To call it from code you want to use "getMultiAdapter".

Try something like (not tested...):

      the_view = zope.component.getMultiAdapter((content, request),
ITheInterfaceImplementedByView, name='name_of_view')

Search for "getMultiAdapter" in the Zope 3 source code and you will  
probably find some sample code etc.

Mvh Sebastian

5 nov 2007 kl. 00.45 skrev David Bain:

> I have an object (a grok.Application), I use self.context to  
> retrieve it and get something like this [<myapp.app.MyApp object at  
> 0x36144f0>].
> I have a page template location src/myapp/app_templates/myappform.pt
> I'd like to be able to call myappform.pt in a method
> something like:
> output = self.context.myappform()
> return output
> Just not sure how to do this. Any pointers would be helpful
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev

More information about the Grok-dev mailing list