2013-07-06 2 views
2

몇 가지 appengine 모델과 autodoc을 사용하고 있습니다. 그러나 적용하려면 속성에 대한 내 설명서를 얻는 방법을 찾을 수 없습니다. NDB을 사용하고 Sphinx으로 문서를 작성합니다. 모델에 예를 들어 Appengine 모델 속성 docstring

은 : 내용에 대한 결과 문서화 문자열은

이 값이 내가 시도

제한된 길이의 텍스트 문자열입니다 속성 색인

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__을 설정해도 아무런 효과가 없습니다.

내 자신의 docstring을 사용하는 방법에 대한 아이디어가 있습니까?

+0

스핑크스의 전문가가 아니지만 docstring 클래스의 필드를 문서화해야합니다. –

+0

@DanielRoseman 코드에서 발생하는 필드를 문서화하는 것이 일반적입니다. 일반 수업에도 적용됩니다. –

+0

정말요? 내가 사용한 문서 형식이 아닙니다. 코멘트에 표시 할 수는 없지만 예를 들어 [Google Python 오픈 소스 스타일 가이드] (http://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Comments# 주석) (Classes 하위 섹션으로 이동하려면 조금 아래로 스크롤하십시오.) 클래스 레벨 docstring 안에 Attributes 섹션이 포함되어 있습니다. –

답변

0

대답은 스핑크스가 잘 작동한다는 것입니다. 재구성되지 않은 잘못된 출력물을보고있었습니다. 둘 다 작동합니다 :

content = ndb.StringProperty() 
"The content" 

#: the content 
content = ndb.StringProperty() 
관련 문제