diff options
author | Daniel Neuhäuser <ich@danielneuhaeuser.de> | 2010-05-24 17:32:00 +0200 |
---|---|---|
committer | Daniel Neuhäuser <ich@danielneuhaeuser.de> | 2010-05-24 17:32:00 +0200 |
commit | a83c48ec8a5f275c5ecb67251945eb454969ef90 (patch) | |
tree | b34fdfed46c45b80f6d3d8d24688e218503372cb /sphinx/ext/autodoc.py | |
parent | 614a7f048fb51de38b1a55460714670c3f6de901 (diff) | |
download | sphinx-git-a83c48ec8a5f275c5ecb67251945eb454969ef90.tar.gz |
test_autodoc.test_get_doc now passes
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r-- | sphinx/ext/autodoc.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 8a827a91f..1113f97a0 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -411,9 +411,11 @@ class Documenter(object): def get_doc(self, encoding=None): """Decode and return lines of the docstring(s) for the object.""" docstring = self.get_attr(self.object, '__doc__', None) - if docstring: - # make sure we have Unicode docstrings, then sanitize and split - # into lines + # make sure we have Unicode docstrings, then sanitize and split + # into lines + if isinstance(docstring, unicode): + return [prepare_docstring(docstring)] + elif docstring: return [prepare_docstring(force_decode(docstring, encoding))] return [] @@ -934,9 +936,12 @@ class ClassDocumenter(ModuleLevelDocumenter): docstrings = [initdocstring] else: docstrings.append(initdocstring) - - return [prepare_docstring(force_decode(docstring, encoding)) - for docstring in docstrings] + doc = [] + for docstring in docstrings: + if not isinstance(docstring, unicode): + docstring = force_decode(docstring, encoding) + doc.append(prepare_docstring(docstring)) + return doc def add_content(self, more_content, no_docstring=False): if self.doc_as_attr: |