[Zope] newbie question - variables?
AM
list_subscriber@neurobs.com
Wed, 05 Feb 2003 12:53:18 -0800
you should be able to if its a dtml-method. ie if the dtml-method is in
the page via a dtml-var
am
jonatan wrote:
>hey !
>
>thanks for all your help.
>
>i will look around this stuff today.
>
>
>so one more quick question:
>
>after declaring variables with REQUEST.set, i can access them in a z sql
>method called from the same file, but cannot access them from a dtml
>method called the same way?
>
>
>really thanks,
>
>jonatan
>
>
>ps. looks like i have should pay more attention to advanced dtml docs
>
>
>On Wed, 2003-02-05 at 02:10, AM wrote:
>
>
>>jonatan wrote:
>>
>>
>>
>>>On Tue, 2003-02-04 at 17:01, AM wrote:
>>>
>>>
>>>
>>>
>>>>page 2 if viewed in both cases should give a key error because var1 or
>>>>var2 are not in its namespace. but both the approaches should work when
>>>>viewing page1 ( I just tested that ).
>>>>
>>>>
>>>>
>>>>
>>>in the second case, i passed var2, so why shouldn't it work? :)
>>>
>>>
>>>
>>>
>>what I meant was that if page2 is viewed as is, then you would get an
>>error because there is no definition of var1/2 on page two, but when you
>>view page1 which has page2 embedded in it, there shouldnt be any errors.
>>
>>
>>
>>>btw, if i call z sql functions this way:
>>>
>>><dtml-call expr="REQUEST.set('param1','1st parameter')">
>>><dtml-call expr="REQUEST.set('param2','2nd parameter')">
>>><dtml-call sqlDoSomething>
>>>
>>>
>>>
>>>
>>ideally it should.
>>
>>
>>
>>>then it works, and if i was calling a dtml method instead of an sql one,
>>>then it doesnt.
>>>
>>>is this the way it should go?
>>>
>>>if this is, how can i access parent's namespace (values set by
>>>REQUEST.set, etc) ?
>>>
>>>
>>>
>>>
>>>
>>>
>>>>Could you please provide the error traceback, which should be on the
>>>>page if you are running 2.5.x or in the error_log if you are running 2.6
>>>>
>>>>
>>>>
>>>>
>>>i got confused now. :) so whats the normal behaviour?
>>>
>>>which traceback should i post? the first or second one? page1 or page2?
>>>
>>>
>>>
>>>
>>>
>>whereever you get the key error... the key error should not appear for
>>page1 and on page 2 there should be an attribute error. so whereever you
>>get a KEY error just include that
>>
>>hth
>>AM
>>
>>
>>
>>>
>>>
>>>
>>>
>>>>AM
>>>>
>>>>
>>>>
>>>>
>>>
>>>thanks for your help,
>>>
>>>
>>>jonatan
>>>
>>>
>>>
>>>
>>>
>>>
>>>>jonatan wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>i have two functions: page1 and page2
>>>>>
>>>>>page1 contains:
>>>>>
>>>>><dtml-call expr="REQUEST.set('var1','do not work')">
>>>>><dtml-var page2>
>>>>>
>>>>>
>>>>>
>>>>>page2:
>>>>>
>>>>><dtml-var REQUEST>
>>>>><dtml-var var1>
>>>>>
>>>>>
>>>>>this makes a KeyError for both ....
>>>>>
>>>>>and if i say
>>>>><dtml-var expr="page2(var2='hey there')">
>>>>>
>>>>>and in page2:
>>>>>
>>>>><dtml-var var2>
>>>>>
>>>>>then this works ...
>>>>>
>>>>>how's all this? how can i access the caller's namespace?
>>>>>
>>>>>
>>>>>thanks for the help,
>>>>>
>>>>>
>>>>>jonatan
>>>>>
>>>>>
>>>>>_______________________________________________
>>>>>Zope maillist - Zope@zope.org
>>>>>http://mail.zope.org/mailman/listinfo/zope
>>>>>** No cross posts or HTML encoding! **
>>>>>(Related lists -
>>>>>http://mail.zope.org/mailman/listinfo/zope-announce
>>>>>http://mail.zope.org/mailman/listinfo/zope-dev )
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
--
==================================================================
Aseem Mohanty
Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706
(R) 510 7696011 (M) 510 3014871 (O) 510 5279231
==================================================================
"I saw `cout' being shifted "Hello world" times to the left and
stopped right there!!" -- Steve Gonedes
==================================================================