[Zope] How to get "context" in an instance method
Paul Tiemann
mrchumple@hotmail.com
Tue, 05 Mar 2002 18:22:10 -0700
This probably has a simple solution, but I'm probably going to have to sleep
on it to find it. Thanks in advance for any help...
I have a class derived from ObjectManager and SimpleItem.Item which defines
a directory structure under it. Something like this:
class MyZopeProduct( ObjectManager.ObjectManager, SimpleItem.Item )
# ...
def myFunc(self, context=None, REQUEST=None):
doSomethingWithContext(context)
After I add an instance of MyZopeProduct to my root folder (as myinstance) I
can go
to http://me:8080/myinstance and things work as expected. If there is a
folder inside my instance called 'folder' then I can also go to
http://me:8080/myinstance/folder and everything works fine.
What I can't figure out is how to go to
http://me:8080/myinstance/folder/myFunc and have the context (the folder
instance object) passed into my script. I've been hunting through the
source for something similar but I can't find it. It's probably something
simple, but I just can't seem to find how to get the context. When I call
myFunc the REQUEST variable is inserted, but the context always comes back
as None. All other Acquisition-related functionality seems to work for
"folder", like pulling 'index_html' out of the root because it doesn't have
one of its own (and neither does "myinstance")
I want to be able to use Acquisition within my Python Product code... Is it
possible?
Thanks in advance!
-Paul
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com