首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Appengine模型属性docstring

Appengine模型属性docstring
EN

Stack Overflow用户
提问于 2013-07-06 20:03:32
回答 1查看 99关注 0票数 2

我正在使用几个应用程序模型和自动文档。但是,我找不到任何方法来获取我的文档来应用属性。我正在使用NDB并使用狮身人面像构建文档。

例如,在模型中:

代码语言:javascript
复制
class Greeting(ndb.Model):
  """Models an individual Guestbook entry with content and date."""
  content = ndb.StringProperty()
  date = ndb.DateTimeProperty(auto_now_add=True)

生成的内容文档字符串为

一个索引属性,其值为有限长度的文本字符串。

我尝试了以下方法:

代码语言:javascript
复制
  "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__没有任何效果。

知道怎么用我自己的docstring吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-07 02:26:41

答案是狮身人面像运作得很好。我看错了没有重建的文档输出的副本。这两项工作:

代码语言:javascript
复制
content = ndb.StringProperty()
"The content"

#: the content
content = ndb.StringProperty()
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17506620

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档