Appengine模型属性docstring

2024-04-16 19:50:39 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用几种appengine模型和autodoc。但是我找不到 获取要应用的属性的文档的方法。我正在使用NDB并使用Sphinx构建文档。你知道吗

例如模型:

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

内容的结果docstring为

An indexed Property whose value is a text string of limited length

我尝试了以下方法:

  "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")

他们都没有给出一个错误,或工作-我总是得到“一个索引属性…”。我很惊讶 显式设置\uuu doc \uuuu没有效果。你知道吗

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


Tags: the方法文档模型datedoc属性content
1条回答
网友
1楼 · 发布于 2024-04-16 19:50:39

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

content = ndb.StringProperty()
"The content"

#: the content
content = ndb.StringProperty()

相关问题 更多 >