mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #627: Fix tracebacks for AttributeErrors in autosummary generation.
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -1,6 +1,8 @@
|
|||||||
Release 1.0.8 (Sep 23, 2011)
|
Release 1.0.8 (Sep 23, 2011)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
* #627: Fix tracebacks for AttributeErrors in autosummary generation.
|
||||||
|
|
||||||
* Fix the ``abbr`` role when the abbreviation has newlines in it.
|
* Fix the ``abbr`` role when the abbreviation has newlines in it.
|
||||||
|
|
||||||
* #727: Fix the links to search results with custom object types.
|
* #727: Fix the links to search results with custom object types.
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ from jinja2.sandbox import SandboxedEnvironment
|
|||||||
from sphinx.ext.autosummary import import_by_name, get_documenter
|
from sphinx.ext.autosummary import import_by_name, get_documenter
|
||||||
from sphinx.jinja2glue import BuiltinTemplateLoader
|
from sphinx.jinja2glue import BuiltinTemplateLoader
|
||||||
from sphinx.util.osutil import ensuredir
|
from sphinx.util.osutil import ensuredir
|
||||||
|
from sphinx.util.inspect import safe_getattr
|
||||||
|
|
||||||
def main(argv=sys.argv):
|
def main(argv=sys.argv):
|
||||||
usage = """%prog [OPTIONS] SOURCEFILE ..."""
|
usage = """%prog [OPTIONS] SOURCEFILE ..."""
|
||||||
@@ -135,10 +136,14 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst',
|
|||||||
template = template_env.get_template('autosummary/base.rst')
|
template = template_env.get_template('autosummary/base.rst')
|
||||||
|
|
||||||
def get_members(obj, typ, include_public=[]):
|
def get_members(obj, typ, include_public=[]):
|
||||||
items = [
|
items = []
|
||||||
name for name in dir(obj)
|
for name in dir(obj):
|
||||||
if get_documenter(getattr(obj, name), obj).objtype == typ
|
try:
|
||||||
]
|
documenter = get_documenter(safe_getattr(obj, name), obj)
|
||||||
|
except AttributeError:
|
||||||
|
continue
|
||||||
|
if documenter.objtype == typ:
|
||||||
|
items.append(name)
|
||||||
public = [x for x in items
|
public = [x for x in items
|
||||||
if x in include_public or not x.startswith('_')]
|
if x in include_public or not x.startswith('_')]
|
||||||
return public, items
|
return public, items
|
||||||
|
|||||||
Reference in New Issue
Block a user