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."""
security=getSecurityManager()
security.addContext(self)
try:
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)
Cheers,
Evan @ digicool & 4-am
_______________________________________________
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 )