[Checkins] SVN: grok/trunk/src/grok/util.py Make isclass() check a bit more tolerant. The metaclass of a class doesn't have

Philipp von Weitershausen philikon at philikon.de
Wed Feb 7 20:38:38 EST 2007


Log message for revision 72437:
  Make isclass() check a bit more tolerant.  The metaclass of a class doesn't have
  to be either type (new-style class) or types.ClassType (old-style class), but it
  can also be a subclass of either one.
  
  This tolerance is needed if we want to grok ExtensionClasses :).
  

Changed:
  U   grok/trunk/src/grok/util.py

-=-
Modified: grok/trunk/src/grok/util.py
===================================================================
--- grok/trunk/src/grok/util.py	2007-02-08 01:30:36 UTC (rev 72436)
+++ grok/trunk/src/grok/util.py	2007-02-08 01:38:36 UTC (rev 72437)
@@ -37,7 +37,7 @@
 def isclass(obj):
     """We cannot use ``inspect.isclass`` because it will return True
     for interfaces"""
-    return type(obj) in (types.ClassType, type)
+    return isinstance(obj, (types.ClassType, type))
 
 
 def check_subclass(obj, class_):



More information about the Checkins mailing list