Finder now looks for an exact match of the module that originally defined the class, by name

This commit is contained in:
Jason Yeung 2006-06-15 01:14:03 +00:00
parent 86837677b6
commit 85de2b40df
1 changed files with 5 additions and 1 deletions

View File

@ -16,7 +16,11 @@ def findClassInModule(module, className, visited):
classObj = module.__dict__.get(className)
if classObj and ((type(classObj) == types.ClassType) or
(type(classObj) == types.TypeType)):
return [classObj, module.__dict__]
if classObj.__module__ == module.__name__:
return [classObj, module.__dict__]
else:
# print "Must have found a module that imported this class", classObj, module
pass
# Now filter out all the modules and iterate through them
moduleList = filter(lambda value: type(value) == types.ModuleType, module.__dict__.values())