summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauro Neto <lauro.neto@openbossa.org>2011-04-26 16:28:22 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:16 -0300
commit4fd1c23ae3b631188aebbf73251d04c18c42f274 (patch)
treea55d7319ac7db7ebfe524ea1385ae3bb36e2260d
parent8eb96fc200e2ecebdd0945475c10c458c308ef2a (diff)
Update inheritance diagram sphinx extension.
Better handling missing classes. Reviewer: Renato Araujo <renato.filho@openbossa.org> Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r--doc/inheritance_diagram.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/doc/inheritance_diagram.py b/doc/inheritance_diagram.py
index 7b13094e..616b4705 100644
--- a/doc/inheritance_diagram.py
+++ b/doc/inheritance_diagram.py
@@ -100,15 +100,22 @@ class InheritanceGraph(object):
__import__(fullname)
todoc = sys.modules[fullname]
except ImportError:
+ # else it is a class, then import the module
+ if not path:
+ if currmodule:
+ # try the current module
+ path = currmodule
+ else:
+ raise InheritanceException(
+ 'Could not import class %r specified for '
+ 'inheritance diagram' % base)
try:
- __import__(currmodule)
- todoc = sys.modules[currmodule]
- for attr in name.split('.'):
- todoc = getattr(todoc, attr)
+ __import__(path)
+ todoc = getattr(sys.modules[path], base)
except (ImportError, AttributeError):
raise InheritanceException(
'Could not import class or module %r specified for '
- 'inheritance diagram' % (currmodule + '.' + name))
+ 'inheritance diagram' % (path + '.' + base))
# If a class, just return it
if inspect.isclass(todoc):