[Zope] External method strangeness

Ken Kinder kkinder@messagemedia.com
Sun, 16 Apr 2000 09:43:58 -0600


Well in Python, the self attribute would usually point to the object the 
method is a member of. I would try:

   def hello(self=None, someVar):
       print someVar

and call it like this:

   <dtml-var expr="hello(someVar='Hello everybody!')">

Normally, I would expect it to simply tell you that you have the wrong 
number of parameters, but it might not be passing self under the 
conditions you called it. By defaulting it to None and specifying 
another argument by name, you're covered either way.

Jim Abrams wrote:
> 
> Ok I'm a zope newbie (abou 5 days), but I've come across some
> external method oddities.
> 
> If I create a method such as
> 
> def hello(self):
>     return self.id
> 
> then call it like
> 
> 
> I get back the name of the folder the method is contained in,
> as expected.
> 
> However if I call something like...
> 
> 
> The 'somestring' is put into the 'self' param in the external method.
> Zope throws an exception saying that "string object has no attribite
> 'id'"
> 
> Is that expected behavior?
> 
> ----------
> Jim Abrams
> jim@abramstechnology.com
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 
> 
> 
>