我一直在尝试记录基于MongoEngine的应用程序,但是我在Document类上记录属性时遇到了问题.
我采用了正确的语法,如下所示:
class Asset(Document):
#: This is the URI of the document
uri = StringField()
Run Code Online (Sandbox Code Playgroud)
我已经尝试过各种记录这些属性的方法,我发现这些属性甚至添加了一个不是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 """
Run Code Online (Sandbox Code Playgroud)
我已在相应的.rst文件中尝试了各种指令组合.目前它看起来像这样:
.. currentmodule:: mymodule.asset
.. autoclass:: Asset
.. autoattribute:: Asset.foo
.. autoattribute:: Asset.uri
Run Code Online (Sandbox Code Playgroud)
输出不是很令人满意:该foo属性根本没有显示文档,而uri字段有MongoEngine的"一个unicode字符串字段".(StringField该类文档)作为文档.此外,属性文档不会放在类的"下"(与automodule +:members: - 一起输出所有带有MongoEngine描述的字段)
我想念狮身人面像扩展吗?或者我搞砸了语法?