##// END OF EJS Templates
don't rely on hasattr in utils.dir2...
Jörgen Stenarson -
Show More
@@ -20,8 +20,14 b''
20 20 def get_class_members(cls):
21 21 ret = dir(cls)
22 22 if hasattr(cls,'__bases__'):
23 for base in cls.__bases__:
24 ret.extend(get_class_members(base))
23 try:
24 bases = cls.__bases__
25 except AttributeError:
26 # `obj` lied to hasattr (e.g. Pyro), ignore
27 pass
28 else:
29 for base in bases:
30 ret.extend(get_class_members(base))
25 31 return ret
26 32
27 33
@@ -59,6 +65,9 b' def dir2(obj):'
59 65 except TypeError:
60 66 # This will happen if `obj` is a class and not an instance.
61 67 pass
68 except AttributeError:
69 # `obj` lied to hasatter (e.g. Pyro), ignore
70 pass
62 71
63 72 # Support for PyCrust-style _getAttributeNames magic method.
64 73 if hasattr(obj, '_getAttributeNames'):
@@ -69,6 +78,9 b' def dir2(obj):'
69 78 # `obj` is a class and not an instance. Ignore
70 79 # this error.
71 80 pass
81 except AttributeError:
82 # `obj` lied to hasatter (e.g. Pyro), ignore
83 pass
72 84
73 85 if may_have_dupes:
74 86 # eliminate possible duplicates, as some traits may also
General Comments 0
You need to be logged in to leave comments. Login now