def dispatchResult(self, request, node, result):
"""Check a given result from handling a node and look up a NodeMutator
adapter which will convert the result into a node and insert it
into the DOM tree. Return the new node.
"""
if not isinstance(result, defer.Deferred):
if node.parentNode is not None:
node.parentNode.replaceChild(result, node)
else:
raise RuntimeError, "We're dying here, please report this immediately"
else:
self.outstandingCallbacks += 1
result.addCallback(self.dispatchResultCallback, request, node)
result.addErrback(self.renderFailure, request)
# Got to wait until the callback comes in
return result
评论列表
文章目录