#284 G{classtree XXX} dies if XXX is not classname

v3.0
open
nobody
5
2008-07-15
2008-07-15
Anonymous
No

When a user includes the epytext "G{classtree ClassName}" in the docstring for a class, if the name "ClassName" does not match the actual name of the class, epydoc crashes with a stack trace like this:

Traceback (most recent call last):
File "/usr/bin/epydoc-3.0.1__py_2.5/scripts-2.5/epydoc", line 13, in <module>
cli()
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/cli.py", line 965, in cli
main(options, names)
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/cli.py", line 783, in main
write_html(docindex, options)
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/cli.py", line 823, in write_html
html_writer.write(options.target)
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/docwriter/html.py", line 641, in write
self._write(self.write_class, directory, filename, doc)
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/docwriter/html.py", line 711, in _write
write_func(f.write, *args)
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/docwriter/html.py", line 880, in write_class
out(self.descr(doc, 2)+'\n\n')
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/docwriter/html.py", line 3344, in descr
return self._attr_to_html('descr', api_doc, indent)
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/docwriter/html.py", line 3336, in _attr_to_html
return self.docstring_to_html(pds, api_doc, indent)
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/docwriter/html.py", line 3361, in docstring_to_html
context=where).strip()
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/markup/epytext.py", line 1782, in to_html
docindex, context, indent)
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/markup/epytext.py", line 1820, in _to_html
for c in tree.children]
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/markup/epytext.py", line 1878, in _to_html
docindex, context)
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/markup/epytext.py", line 1903, in _build_graph
return class_tree_graph(bases, linker, context)
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/docwriter/dotgraph.py", line 1017, in class_tree_graph
graph = DotGraph('Class Hierarchy for %s' % name_list(bases, context),
File "/usr/bin/epydoc-3.0.1__py_2.5/lib/epydoc/docwriter/dotgraph.py", line 1345, in name_list
names = [str(d.canonical_name.contextualize(context)) for d in api_docs]
AttributeError: 'NoneType' object has no attribute 'canonical_name'

Discussion