On Monday 05 August 2002 17:42, 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
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.
It really does not work or probably You just does not understand what I need (or I not understand You as well). O.K. I'll try again to exaplain. In Zope product, I do: class foo: def bar(self): return self.context.MyObject() ...and this does not work. O.K., but in the _same_ Zope Product, I just add simple "def" (not within a class), like: def testHere(self): return self.MyObject() ...and it works. O.K., now how to pass the "context", since all the time Zope returns me "The variavle 'context' is not defined"? Can You show me a code a little? -- Sincerely yours, Bogdan M. Maryniuck Sigh. I like to think it's just the Linux people who want to be on the "leading edge" so bad they walk right off the precipice. (Craig E. Groeschel)