On Mon, 3 Apr 2000, Suneel Iyer wrote:
I have the following simple code fragment:
dtml-call "REQUEST.set('test',UserExists)"> <br /> The value of test is <dtml-var test> <br />
Where 'UserExists' is a boolean value set using <dtml-let>. I want to be sure that 'UserExists' is being copied into 'test', but <dtml-var test> does not yield the value of 'UserExists' (in fact, it yields nothing at all). What am I
The following code snippet: <dtml-let UserExists="1==1"> <dtml-call "REQUEST.set('test',UserExists)"> <br> The value of test is <dtml-var test> <br> </dtml-let> Yields the following output when rendered: The value of test is 1 So I can't reproduce your problem.
doing wrong? Also, I have some doubt about the scope of the REQUEST variable. For instance, if in the next line of the code fragment a call is made to another dtml method called "myMethod", does the REQUEST variable 'test' go out of scope in "myMethod"? Thanks for your time.
I'm not sure scope is the best way to think about it. What you've got is an explicit name space stack, of which REQUEST is one element. To pass the namespace stack in to your sub-method, you want to call it with the first two arguments of _.None,_ (eg: <dtml-call "myMethod(_.None,_,myarg='somevalue')">). _.None is the 'client', and is also searched to resolve names; in this example we are not passing in a client. '_' is the name of the Zope namespace object. If you don't pass those two args, then your method will probably loose its access to the namespace. (The situation where it won't is if your "call" is of the form <dtml-var myMethod>; in that case Zope will automagically supply the client and namespace arguments). Hope this helps. --RDM