Commit d3458376 authored by Evan Simpson's avatar Evan Simpson

Set 'this' on templateDict when calling DTML

parent 59155ce2
...@@ -89,7 +89,7 @@ Handler for Python expressions, using the pre-Python 2.1 restriction ...@@ -89,7 +89,7 @@ Handler for Python expressions, using the pre-Python 2.1 restriction
machinery from PythonScripts. machinery from PythonScripts.
""" """
__version__='$Revision: 1.4 $'[11:-2] __version__='$Revision: 1.5 $'[11:-2]
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from Products.PythonScripts.Guarded import _marker, \ from Products.PythonScripts.Guarded import _marker, \
...@@ -126,9 +126,9 @@ def validate(accessed, container, name, value, dummy): ...@@ -126,9 +126,9 @@ def validate(accessed, container, name, value, dummy):
def call_with_ns(f, ns, arg=1): def call_with_ns(f, ns, arg=1):
td = TemplateDict() td = TemplateDict()
td.validate = validate td.validate = validate
td.this = None td.this = ns['here']
td._push(ns['request']) td._push(ns['request'])
td._push(InstanceDict(ns['here'], td)) td._push(InstanceDict(td.this, td))
td._push(ns) td._push(ns)
try: try:
if arg==2: if arg==2:
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
Handler for Python expressions that uses the RestrictedPython package. Handler for Python expressions that uses the RestrictedPython package.
""" """
__version__='$Revision: 1.6 $'[11:-2] __version__='$Revision: 1.7 $'[11:-2]
from AccessControl import full_read_guard, full_write_guard, \ from AccessControl import full_read_guard, full_write_guard, \
safe_builtins, getSecurityManager safe_builtins, getSecurityManager
...@@ -136,8 +136,9 @@ class Rtd(RestrictedDTML, TemplateDict): ...@@ -136,8 +136,9 @@ class Rtd(RestrictedDTML, TemplateDict):
def call_with_ns(f, ns, arg=1): def call_with_ns(f, ns, arg=1):
td = Rtd() td = Rtd()
td.this = ns['here']
td._push(ns['request']) td._push(ns['request'])
td._push(InstanceDict(ns['here'], td)) td._push(InstanceDict(td.this, td))
td._push(ns) td._push(ns)
try: try:
if arg==2: if arg==2:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment