Other than explictly passing arguments, the shareable namespace, _, is the logical place to exchange such variables btw DTML and Script(Python). However, the namespace object, a TemplateDict, only allows you to PUSH/POP spaces, not set/change variables, so you have to find or provide something in the namespace that is mutable. You found REQUEST, and there is also SESSION. And you can provide your own mutable namespace as a dictionary: ----- cut here ----- DTML Method <dtml-let myvars="{ 'somevar': 5 }"> <!-- Create My Own Namespace --> <dtml-with myvars mapping> <!-- and Push onto the Search Stack --> Before: <dtml-var somevar> <dtml-call mypython> After: <dtml-var somevar> </dtml-with> </dtml-let> ----- cut here ----- Script(Python) Method ## Script (Python) "mypython" ##bind container=container ##bind context=context ##bind namespace=_ ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## _['myvars']['somevar'] = 7 When the DTML Method is invoked, this will print: Before: 5 After: 7 When the end of the DTML-WITH is reached, the namespace will be popped/discarded, so it won't be permanent, as you wish to avoid. Hope this helps, Jeff Rush Asad Habib wrote:
Hello. Does anyone know how to create a variable in a DTML method which may be updated by a Python script? I am currently using the set method of the REQUEST object to create a variable. However, creating a variable in this fashion renders it permanent. Any help would be appreciated. Thanks.