[Zope] Acquired namespaces within a python product class method?

sean.upton@uniontrib.com sean.upton@uniontrib.com
Fri, 13 Jul 2001 11:56:21 -0700


I'm doing some work on a python product with several classes; one of those
classes is a site container designed to provide a bunch of useful methods to
any object that can acquire them.    I have method1() which is actually used
by DTML methods, etc, and method2, which is called by method1():

class foo(OFS.Folder):
	"""container-type class)"""
	def method1(self):
      	return self.method2()
	def method2(self):
		return 'something'

I have a folder hierarchy like such:
[sitefolder]     (instance of class "foo" provides
    |             method1 and method2 via 
    |             the product's "foo" class code)
    +[subfolder] (Folder that contains a TTW python method called method2)

My problem is that in this case I want to create a method2 in the ODB that
exists in a subfolder of this container, so that method1 (which is acquired
from the parent folder of this subfolder), called in the context of
subfolder, should call method2, but from the namespace of the current
context, rather than self (the context of the sitefolder).  The problem is
that the following doesn't work:

	def method1(self):
		return method2()

How would I get method1(), which resides is acquired, to use the current
namespace when calling method2 from a URL like
/sitefolder/subfolder/method1?  I've tried a few things, but I am a bit
confused...

Sean

=========================
Sean Upton
Senior Programmer/Analyst
SignOnSanDiego.com
The San Diego Union-Tribune
619.718.5241
sean.upton@uniontrib.com
=========================