From: Stephen Simmons <[EMAIL PROTECTED]>
> 1.)  How do you magically get the DTML context from '<dtml-var A>' without
> having to resort to '<dtml-var "A(_,REQUEST)">' in the templates?

A.isDocTemp = 1 # or make it a shared class attribute

> 2.)  How to convert an arbitrary text string into rendered DTML inside a
> python product method?

Here's what I use:

from Globals import HTML
from AccessControl import getSecurityManager

class DTML(HTML):
    """DTML objects are DocumentTemplate.HTML objects that allow
       dynamic, temporary creation of restricted DTML."""
    def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
        """Render the DTML given a client object, REQUEST mapping,
        Response, and key word arguments."""

            return apply(HTML.__call__, (self, client, REQUEST), kw)
        finally: security.removeContext(self)

    def validate(self, inst, parent, name, value, md):
        return getSecurityManager().validate(inst, parent, name, value)


Evan @ digicool & 4-am

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

Reply via email to