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})

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

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to