Пример #1
0
def call_trace(f, *path, **kwargs):
    """
        <p>Execute a function and return all of the debugging information.</p>
    """
    from urquell.invocation import ErrorTrace, execute
    url = urlambda(f, *path, **kwargs)
    return execute(repr(url))
Пример #2
0
  def handle_hash(self,ihash):
    doc = self.blip.GetDocument()
    url = u''

    try:
      sess = SessionWrapper(self.blip.GetId() + self.wave.GetId())
      result = execute('http://urquell-fn.appspot.com/lib/unresolve/' + ihash[1:])
      FrameDisplay(self.blip,sess).display()
      if result and result.has_key('hash'):
        doc.AppendText('\n%s resolves to: %s' % (ihash,result.get('value','None')))
    except Exception, e:
      self.wavelet.CreateBlip().GetDocument().SetText('\n\nException thrown:\n%s' % traceback.format_exc())
Пример #3
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())
Пример #4
0
def map(f, *path, **kw):
    """
        <p>Execute the same function across all of the remaining inputs.</p>
    """
    from urquell.invocation import execute
    return [execute('%s/%s' % (f, p))['value'] for p in path]