On Fri, 2003-01-24 at 14:15, Andreas Jung wrote:
I think the problem is that ExtensionClasses don't work with isinstance()
If this is the case, then there must be a workaround, right? Andy
-aj
--On Freitag, 24. Januar 2003 13:38 -0600 Andrew Altepeter <aaltepet@bethel.edu> wrote:
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
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
--------------------------------------------------------------------- - Andreas Jung http://www.andreas-jung.com - - EMail: andreas at andreas-jung.com - - "Life is too short to (re)write parsers" - ---------------------------------------------------------------------