[Zope] How to render tales in strings in a script
   
    Dieter Maurer
     
    dieter@handshake.de
       
    Thu, 9 Jan 2003 23:34:21 +0100
    
    
  
Elena Schulz wrote at 2003-1-9 11:06 +0100:
 > >   You create a Zope Page Template object, wrap it into a context
 > >   (using its "__of__" method) and then call it.
 > 
 > You mean by the following?
 > #creating:
 > myZPT = Products.PageTemplates.ZopePageTemplate(id=myId, text=myZPTString,
 > content_type=?)
Yes.
 > #wrapping: I did not find any __of__ method!? (Sorry my understanding of
 > this needs some more enlightment
Read about acquisition, e.g. in 
  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
maybe, in the Zope Developer Guide.
"__of__" is a method of "Acquirer", inherited by "ZopePageTemplate".
 > myZPT=context.myZPT
myZPT= myZPT.__of__(context) # wrap it
 > #calling:
 > return context.myId()
return myZPT() # render it
 > What to use for content_type? text/html? or better keeping the default?
You can use "text/html" and "text/xml".
When you use "text/xml" "text" must be a well formed XML document
and the "tal/metal" namespaces must be defined.
Thus, you will probably prefer "text/html".
Dieter