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

Shane Hathaway shane@digicool.com
Mon, 20 Nov 2000 11:45:21 -0500


Chris Gray wrote:
> 
> 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?

They are using an unreleased version of the Python Methods product. 
AFAIK the only thing holding up the release of the new Python Methods is
the renaming.

Shane