Stephen Simmons wrote:

> 
> 2.)  How to convert an arbitrary text string into rendered DTML inside a
> python product method?
> How do you get the object's properties, REQUEST and acquisition context all
> in the namespace?
> 
> I've been trying code like:
>    template = '<span class="purpose"><dtml-var purpose
> fmt="structured_text"></span>'
>    dtml = HTML(template, globals())
>    rendered = dtml(self, REQUEST)

Here's an except from my Python interactive interpreter:

 >>> import DocumentTemplate
 >>> my_dt=DocumentTemplate.HTML("""<dtml-var "1+a">""")
 >>> my_dt(None, {'a':4})
'5'

The object my_dt is callable, and takes the arguments (client, 
namespace). You can put a REQUEST in place of the simple dictionary I 
used above.

If you're trying this, make sure you have the PYTHONPATH environment 
variable set to /your/zope/directory/lib/python


--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net


_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to