私は Twisted を初めて使用し、データベースから名前のリストを表示する単純なリソースを作成しようとしています。これが私のコードの一部です:
#code from my ContactResource class
def render_GET(self, request):
def print_contacts(contacts, request):
for c in contacts:
request.write(c.name)
if not request.finished:
request.finish()
d = Contact.find() #Contact is a Twistar DBObject subclass
d.addCallback(print_contacts, request)
return NOT_DONE_YET
私の質問は、このメソッドを変更して inlineCallbacks デコレータを使用するにはどうすればよいですか?