Beispiel #1
0
 def handle_cmnd(self,cmnd):
   sess = SessionWrapper(self.blip.GetId() + self.wave.GetId())
   if cmnd == '!reset':
     sess.frames = {}
   # if cmnd == '!content errors':
   #   sess.settings['content'] = '__errors__'
   # if cmnd == '!content all':
   #   sess.settings['content'] = '__all__'
   # if cmnd.startswith('!filter'):
   #   sess.settings['content'] = cmnd.split(' ')[1]
   if cmnd == '!help':
     HelpDisplay(self.blip,sess).display()
     return
   sess.save()
   FrameDisplay(self.blip,sess).display()
Beispiel #2
0
  def handle_expr(self,expr):
    doc = self.blip.GetDocument()
    stack_frame = u''
    formatted_args = u''

    try:
      sess = SessionWrapper(self.blip.GetId() + self.wave.GetId())
      result = execute(expr)
      if result and result.has_key('hash'):
        result['url'] = expr
        result['fnum'] = sess.last_fnum() + 1
        sess.frames[result['hash']] = result
        sess.save()
        FrameDisplay(self.blip,sess).display()
        doc.AppendText('\nhttp://urquell-fn.appspot.com/lib %s' % result['hash'])
      elif result and result.has_key('value'):
        ModuleDisplay(self.blip,sess).display(result)
        doc.AppendText('\n%s' % expr)
      elif result and result.has_key('error'):
        data = result['headers']['Host'],result['path'],result['error']['message']
        self.wavelet.CreateBlip().GetDocument().SetText('\n\nExecution error:\nHost: %s\nPath: %s\nError: %s' % data)
    except Exception, e:
      self.wavelet.CreateBlip().GetDocument().SetText('\n\nException thrown:\n%s' % traceback.format_exc())