From d739756f2a1551291f77000c21e3e2788a757319 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 16 Mar 2008 11:10:31 +0000 Subject: [PATCH] Fix autodoc for some conditions where env.autodoc_* is not set. --- sphinx/ext/autodoc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 1822821a9..1cf2a77c9 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -52,19 +52,19 @@ def generate_rst(what, name, members, undoc, add_content, objpath = [] elif what in ('class', 'exception', 'function'): mod, obj = rpartition(name, '.') - if not mod: + if not mod and hasattr(env, 'autodoc_current_module'): mod = env.autodoc_current_module if not mod: mod = env.currmodule objpath = [obj] else: 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 if not mod_cls: mod_cls = env.currclass mod, cls = rpartition(mod_cls, '.') - if not mod: + if not mod and hasattr(env, 'autodoc_current_module'): mod = env.autodoc_current_module if not mod: mod = env.currmodule