[Zope] external methods

Service Informatique CHSR chsrinfo@guetali.fr
Fri, 26 Mar 1999 17:15:53 +0400


Ok, I'm dumb.
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.

Can someone confirm (or infirm?) this?


>Hello,
>
>I'm confused with external methods. Please help.
>
>I want an external method to access its context (for the
>purpose of acquisition, etc.). So I write:
>
>def myExtMethod(self):
>    pass
>
>Within myExtMethod, I should be able to:
>- write self.REQUEST to access the current REQUEST object (I
>need to be able to modify the current REQUEST object with
>self.REQUEST.set(...))
>- or for example self.myzsqlmethod() to call a zsql method object,
>right???
>
>Let's suppose that myExtMethod is:
>
>def myExtMethod(self):
>    l=[]
>    for i in self.l:
>        l.append(i+1)
>    self.REQUEST.set('l', l)
>
>Now, how can I call this method from DTML?
>
><!--#var myExtMethod-->
><!--#var "myExtMethod()"-->
><!--#var "myExtMethod(this())"-->
>
>All don't work. I end up in a traceback. "read only class, buffer"
>
>Any hints?

Regards,
Jephte CLAIN, Service Informatique

PS: I have been looking for an explanation of the problem for
two weeks, until I wrote to the mailing list, and voila! I found the
cause of the problem myself   :-)
One can never be better served than by oneself...