2013-07-06 48 views
2

我正在使用几个appengine模型和autodoc。但是,我找不到任何 获取我的文档以应用属性的方法。我正在使用NDB并用Sphinx构建文档。Appengine模型属性文档字符串

例如与模型:

class Greeting(ndb.Model): 
    """Models an individual Guestbook entry with content and date.""" 
    content = ndb.StringProperty() 
    date = ndb.DateTimeProperty(auto_now_add=True) 

内容将所得文档字符串是

索引属性,其值是有限长度的文本串

我试图以下方法:

"The content" 
    content = ndb.StringProperty() 

    content = ndb.StringProperty() 
    "The content" 

    #: the content 
    content = ndb.StringProperty() 

    content = ndb.StringProperty() 
    content.__doc__="The content" 

    content = ndb.StringProperty(__doc__="the content") 

    content = ndb.StringProperty(doc="the content") 

他们都没有提供错误或工作 - 我总是会得到“索引属性...”。我很惊讶 显式设置__doc__没有效果。

任何想法如何让我自己的文档字符串使用?

+0

不是狮身人面像专家,但我希望你会记录在类docstring本身的领域。 –

+0

@DanielRoseman在代码中出现的文档字段是正常的。它适用于普通班级。 –

+0

真的吗?不是以我曾用过的任何文档格式。我无法在评论中显示,但作为示例,请参阅[Google Python开放源代码样式指南](http://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Comments#注释)(向下滚动一下以转到Classes子部分),其中它们在类级文档字符串中包含一个Attributes部分。 –

回答

0

答案是,斯芬克斯工作得很好。我正在查看未被重建的doc输出的错误副本。这两个工作:

content = ndb.StringProperty() 
"The content" 

#: the content 
content = ndb.StringProperty()