我一直试图记录我的基于MongoEngine的应用程序,但是在记录Document类的属性时遇到了问题。
我已经知道正确的语法如下:
class Asset(Document):
#: This is the URI of the document
uri = StringField()
我已经尝试了所有我发现的记录这些属性的方法,甚至添加了一个不是MongoEngine字段的属性来确保这不是问题:
class Asset(Document):
"""
The representation of a file uploaded into the data store.
"""
#: This is a test attribute.
foo = 'bar'
"""baz?"""
#: This is a URI.
uri = StringField(required=True)
"""This is a URI """
我已经尝试了各种指令的组合并在相应的 .rst
文件中进行了测试。目前看起来是这样的:
.. currentmodule:: mymodule.asset
.. autoclass:: Asset
.. autoattribute:: Asset.foo
.. autoattribute:: Asset.uri
输出结果并不令人满意:属性foo
没有显示任何文档,而uri字段有MongoEngine的“A unicode string field.”(StringField
类的文档)作为文档。此外,属性文档未被放置在类“下方”(与automodule + :members:一样-它输出带有MongoEngine描述的所有字段)。我是否缺少Sphinx扩展?或者我搞错了语法?