[Zope] binding to 'context' from a Python product

Alec Mitchell apm13 at columbia.edu
Sun May 2 23:46:34 EDT 2004


On Sunday 02 May 2004 02:57 pm, Jim Anderson wrote:
> I've reading Zope documentation and python/lib modules and
> have not found a way to bind to the current folder context when
> I run my python product in Zope 2.7.
>
> I'm creating the product with a member function, ex(). So
> for example, if my product is 'sample' and the member function
> is 'ex', I try executing 'sample.ex()'. Inside ex(), I have the
> following code:
>
>     def ex(self):
>         request = context.REQUEST
>
> The product loads ok, but when ex() is called, I get an
> error message:
>
>     Error Type: NameError
>     Error Value: global name 'context' is not defined
>
> Thanks in advance for any tips.

Try request = self.REQUEST.

Alec Mitchell



More information about the Zope mailing list