[Zope] - Getting

Amos Latteier amos@aracnet.com
Fri, 11 Dec 1998 10:04:26 -0800


At 09:27 AM 12/11/98 -0800, Scott wrote:

>This class is defined in the same file as this function.
>Is there some weird scoping issue that I am not aware of?

I would guess that the problem is that most of Zope's classes are actually
ExtensionClasses.

Python 1.5.1 (#0, Apr 13 1998, 20:22:04) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import Acquisition
>>> class A(Acquisition.Implicit):pass
...
>>> type(A)
<extension class ExtensionClass at 00BEC778>
>>> a=A()
>>> isinstance(a,A)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: second argument must be a class


Probably the easiest solution is to add a class attribute like:

class MyProduct(...
    isMyProduct=1
    ...

Then you can do things like:

if hasattrib(self.aq_parent,'isMyProduct') and self.aq_parent.isMyProduct:
    print 'I am within another MyProduct object'

Maybe there are better solutions...

-Amos