From: Curtis Maloney <[EMAIL PROTECTED]>
> What I want to know is, why can't Python Methods refer to anything not
> explicitly passed to them?  I don't want to have to make everything that
> invokes the method have to know to pass it half a dozen objects.
>
> Isn't the idea of a method to be executed in the namespace of it's parent?
I
> want my method to be able to access objects in it's own folder...

Yep.  You just need to make the first parameter of your method 'self', and
not have any parameters with default values.  For example, method plusX::

  <params>self, x</params>
  return len(self.objectIds()) + x

...can be called like 'folder.plusX(3)'.  You can also acquire objects that
your method needs from 'self'.

Cheers,

Evan @ digicool & 4-am


_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
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 )

Reply via email to