I have an external method that returns a string containing dtml, but 
I want it to evaluate the dtml and return the result. How do I do 

I noticed in, say, 
that dtml-containing *files* are used as object methods like this:

        from Globals import HTMLFile
        manage_main = HTMLFile( 'methodEdit', globals() )

so I figured I could do a similar thing with a dtml-containing string 
and an external method:

        from Globals import HTML
        dtml_string = '<dtml-let x="it works"><dtml-var x></dtml-let>'
        external_method = HTML( dtml_string, globals() )

This in fact works, but if I try to reference anything in the current 
object, like

        dtml_string = '<dtml-var id>'

I get KeyError: id.

Apparently I'm getting dtml evaluation but not in the context of the 
current object. What am I doing wrong, and (for extra credit) why 
doesn't have this problem using HTMLFile?


PS: I know I can get the id with

        def external_method( self, REQUEST = None ):

but the real dtml_string I need to evaluate is much more complicated 
than '<dtml-var id>'...

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

Reply via email to