[Zope] isinstance not working

Dieter Maurer dieter@handshake.de
Sun, 26 Jan 2003 19:41:15 +0100


Andrew Altepeter wrote at 2003-1-24 13:38 -0600:
 > I am developing a custom user folder (based off of
 > AccessControl.UserFolder code, and SimpleUserFolder), which inherits
 > from BasicUser.
 > 
 > There are two types of users in this folder, one is the
 > AccessControl.User, and the other is a subclass of it.
 > 
 > Inside getUserNames, I am trying to use isinstance, but it isn't
 > working.  It returns:
 > 
 > >> TypeError: isinstance() arg 2 must be a class or type
The idiom for using "isinstance" for an "ExtensionClass" looks like:

    try: isAnInstance= isinstance(object,ExtClass)
    except TypeError: isAnInstance= 0
    # now "isAnInstance" is true when "object" is an instance of "ExtClass"


Dieter