[Zope] external methods

Service Informatique CHSR chsrinfo@guetali.fr
Mon, 29 Mar 1999 14:57:36 +0400


Hello,

>> After some digging, I found that the problem lies in
>> the expression 'self.l'
>> 
>> 'self.' gives access to the object hierarchy, not the variables
>> namespace.
>> 
>> So, I solved my problem by writing 'self.REQUEST['l']'
>> instead of 'self.l'
>> 
>> Also, I think that this should be clearly documented.
>> Apparently, the only way to acess variables namespaces
>> in external methods is through self.REQUEST
>> This confuses a 'normal' python user whose variable
>> namespace is usually accessed through self.
>
>I believe that you can just ask for it in your function signature:
>
>def my_method(self,l):
>  return l + ' is cool!'


Nope,

With that definition, my_method expect to be called with the arguments
set, eg <!--#var "my_method('Zope')"--> to display "Zope is cool".

However, I want to get the variable l from the namespace. (application
variables made with REQUEST.set, Folder or document properties, etc.)
The question was: is self.REQUEST the only way to access the
variable namespace? And the only way to *modify* the variable namespace
from external methods (with self.REQUEST.set)?

By the way, I'd like to thank Stefan Franke and Pedro Vale Lima who
gave me a pretty quick answer. I did find the answer before they wrote,
but anyway, a thank is not that expensive :-)
Also, thanks to Paul who gave me such a useless answer. :-) (just kidding)

Regards,
Jephte CLAIN
Service Informatique CHSR