[Zope-dev] Zope Book Question: 'context' doesn't work in PythonMethods

Chris Gray cpgray@library.uwaterloo.ca
Mon, 20 Nov 2000 11:25:23 -0500


I tried following one of the Zope Book examples to no avail.

From the scripting chapter:

"Since Python Methods are bound the Zope objects, you can get access to Zope
objects via the context parameter. For example, this methods returns the
number of objects contained by a given Zope object:

        Method id: numberOfObjects
        Parameters:

            return len(context.objectIds())"

I just get a Name Error on context and if I add context as a parameter I
just get told that the parameter was omitted from the request.  This works,
however:

        Method id: numberOfObjects
        Parameters: self

            return len(self.objectIds())

Am I missing something?  Is this because Amos and Michel seem to be using
2.2.3 and I'm using 2.2.2?

adTHANKSvance
Chris