谷歌波浪机器人在线回复

2024-06-07 18:28:29 发布

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

我最近一直在为googlewave开发我的第一个机器人,它所做的一个重要部分就是将内联回复插入到一个blip中。我一辈子都不知道该怎么做!在

API文档中有一个函数InsertInlineBlip,听起来很有前途,但是调用它似乎没有任何作用!在

编辑: 这似乎是一个已知的错误。然而,问题仍然存在,插入内联blip的正确方法是什么?我假设是这样的:

inline = blip.GetDocument().InsertInlineBlip(positionInText)
inline.GetDocument().SetText("some text")

Tags: 方法函数文档api编辑错误机器人inline
3条回答

这似乎以前是一个bug,但是今天的更新有望修复它: http://code.google.com/p/google-wave-resources/wiki/WaveAPIsChangeLog

如果您查看OpBasedDocument.InsertInlineBlip()sourcecode,您将看到以下内容:

 412 -  def InsertInlineBlip(self, position): 
 413      """Inserts an inline blip into this blip at a specific position. 
 414   
 415      Args: 
 416        position: Position to insert the blip at. 
 417   
 418      Returns: 
 419        The JSON data of the blip that was created. 
 420      """ 
 421      blip_data = self.__context.builder.DocumentInlineBlipInsert( 
 422          self._blip.waveId, 
 423          self._blip.waveletId, 
 424          self._blip.blipId, 
 425          position) 
 426      # TODO(davidbyttow): Add local blip element. 
 427      return self.__context.AddBlip(blip_data) 

我认为TODO的评论表明这个功能还没有激活。该方法应该是可调用的并正确返回,但是我怀疑文档操作没有应用于全局文档。在

你在帖子中包含的语法看起来是正确的。正如你在上面看到的,InsertInlineBlip()returns the valueAddBlip(),这是…dun,dun,dun。。。一点点。在

^{pr2}$

编辑: 值得注意的是,插入方法InsertInlineBlip(self, position)的方法签名与插入方法InsertElement(self, position, element)显著不同。InsertInlineBlip()不接受元素参数来插入。似乎InsertInlineBlip()的当前逻辑更像Blip.CreateChild(),它返回一个新的子blip来工作。由此我们可以怀疑,随着功能的增加,这个API会发生变化。在

可能是bug。在

相关问题 更多 >

    热门问题