[Zope] isinstance not working

Andrew Altepeter aaltepet@bethel.edu
24 Jan 2003 13:38:49 -0600


Hi All,

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

Here's the code that I'm using:

class PortalUser(User):
    __doc__ = """This is the class for PortalUsers"""

class PortalUserFolder(BasicUserFolder):
 ...
 ...
     """Return a sorted list of usernames"""
    def getUserNames(self,luser=1,puser=1):
        names = self.local_data.keys()
        names.sort()
        if (luser==1 and puser!=1):
            for name in names[:]:
                if (isinstance(name,PortalUser)):
                    names.remove(name)
        elif (luser!=1 and puser==1):
            for name in names[:]:
                if not (isinstance(name,PortalUser):
                    names.remove(name)
        return names

Any ideas as to what's going on here, or why this is not working would
be great!  Oh, I've also tries using PortalUserFolder, and User as arg2
to isinstance.

Thanks!

Andy