[Zope] Zope context

Oliver Bleutgen myzope@gmx.net
Mon, 05 Aug 2002 18:19:36 +0200


Chris Withers wrote:
> DA Loeffler wrote:
> 
>> I got round this one by actually passing the context to the class
>> constructor as an argument, and storing it as self.context with the
>> class's __init__ method. You can then freely call things on it, in my
>> case
> 
> 
> Ouch! Bad! Pain! Don't!

To be a little bit more verbose than Chris, imagine copying and pasting 
  this instance. Or if you have this setting:

Folders a,b, both subfolders of c, and you do something like

c.a.b.manage_addProduct['yourProduct'].addYourProduct( ... ).

What exactly is the "context" now?

> 
>> for r in self.context.someSQLMethod():
>>
>> or whatever. Since python functions are call-by-reference, you can
>> even do self.context.manage_addFolder() or whatever, and it will affect
>> the context originially passed to it.

See above, where would the folder be added?

 > [SNIP]

Are you both, Bogdan and David, talking about "context" as in the 
context occuring with python scripts, perhaps?


cheers,
oliver