Fix autodoc for some conditions where env.autodoc_* is not set.

This commit is contained in:
Georg Brandl 2008-03-16 11:10:31 +00:00
parent 5d253d4293
commit d739756f2a

View File

@ -52,19 +52,19 @@ def generate_rst(what, name, members, undoc, add_content,
objpath = [] objpath = []
elif what in ('class', 'exception', 'function'): elif what in ('class', 'exception', 'function'):
mod, obj = rpartition(name, '.') mod, obj = rpartition(name, '.')
if not mod: if not mod and hasattr(env, 'autodoc_current_module'):
mod = env.autodoc_current_module mod = env.autodoc_current_module
if not mod: if not mod:
mod = env.currmodule mod = env.currmodule
objpath = [obj] objpath = [obj]
else: else:
mod_cls, obj = rpartition(name, '.') mod_cls, obj = rpartition(name, '.')
if not mod_cls: if not mod_cls and hasattr(env, 'autodoc_current_class'):
mod_cls = env.autodoc_current_class mod_cls = env.autodoc_current_class
if not mod_cls: if not mod_cls:
mod_cls = env.currclass mod_cls = env.currclass
mod, cls = rpartition(mod_cls, '.') mod, cls = rpartition(mod_cls, '.')
if not mod: if not mod and hasattr(env, 'autodoc_current_module'):
mod = env.autodoc_current_module mod = env.autodoc_current_module
if not mod: if not mod:
mod = env.currmodule mod = env.currmodule