[Zope] Different external method and acquisition syntax question.

Dieter Maurer dieter@handshake.de
Wed, 8 Aug 2001 20:45:55 +0200 (CEST)


jelle writes:
 > #external method calling a python script
 > def ex_test(self,param=''):
 >     return ' ex_test ' + self.util.py_delta()
 > 
 > /test/util/py_delta
 > #python script
 > return ' delta '
 > 
 > /test/dev/alpha/py_alpha
 > #python script calling a python script
 > return ' py_alpha ' + context.beta.py_beta()
 > 
 > /test/dev/master/beta/py_beta
 > #python script calling an external method
 > return ' py_beta ' + context.util.ex_test('boing')
That's easy to explain: the magic of automatic "self" passing hits you:

  External Method passes "aq_parent" automatically as first parameter
  provided both of the following conditions are met:

    1. the first parameter is named "self"

    2. the number of provided parameters is one less than the
       number of mandatory parameters.

In your case, the number of mandatory parameters is 1
and you pass one argument 'boing'.
That means, "self" is not passed automatically.
It gets the value "boing", which has no attributes, of course.


Dieter