Example #1
0
def dumpd(params, methodname=None, methodresponse=None, encoding=None, allow_none=False, tid=None):
    assert tid is not None, "need a transaction identifier"
    if methodname:
        out = ebencode({'y':'q', 't':tid, 'q':methodname, 'a':params})
    elif isinstance(params, DFault):
        out = ebencode({'y':'e', 't':tid, 'c':params.faultCode, 's':params.faultString})
    elif methodresponse:
        out = ebencode({'y':'r', 't':tid, 'r':params})
    else:
        raise Error("")
    return out
Example #2
0
def dumpd(params, methodname=None, methodresponse=None, encoding=None, allow_none=False, tid=None):
    assert tid is not None, "need a transaction identifier"
    if methodname:
        out = ebencode({'y':'q', 't':tid, 'q':methodname, 'a':params})
    elif isinstance(params, DFault):
        out = ebencode({'y':'e', 't':tid, 'c':params.faultCode, 's':params.faultString})
    elif methodresponse:
        out = ebencode({'y':'r', 't':tid, 'r':params})
    else:
        raise Error("")
    return out
Example #3
0
def dumps(params, methodname=None, methodresponse=None, encoding=None, allow_none=False):
    if methodresponse and isinstance(params, TupleType):
        assert len(params) == 1, "response tuple must be a singleton"
    if methodname:
        out = ebencode({'y':'q', 'q':methodname, 'a':params})
    elif isinstance(params, Fault):
        out = ebencode({'y':'e', 'c':params.faultCode, 's':params.faultString})
    elif methodresponse:
        out = ebencode({'y':'r', 'r':params[0]})
    else:
        raise Error("")
    return out
Example #4
0
def dumps(params, methodname=None, methodresponse=None, encoding=None, allow_none=False):
    if methodresponse and isinstance(params, TupleType):
        assert len(params) == 1, "response tuple must be a singleton"
    if methodname:
        out = ebencode({'y':'q', 'q':methodname, 'a':params})
    elif isinstance(params, Fault):
        out = ebencode({'y':'e', 'c':params.faultCode, 's':params.faultString})
    elif methodresponse:
        out = ebencode({'y':'r', 'r':params[0]})
    else:
        raise Error("")
    return out
Example #5
0
 def dump(self, file, top=None):
     d = self.data
     if top is not None:
         d = d[:top]
     root = []
     for e in d:
         n = {}
         root.append(n)
         n['l'] = (e.inlinetime, e.callcount, e.totaltime, label(e.code))
         n['c'] = []
         for se in e.calls or []:
             n['c'].append((se.inlinetime, se.callcount,
                            se.totaltime, label(se.code)))
     file.write(ebencode(root))
Example #6
0
 def dump(self, file, top=None):
     d = self.data
     if top is not None:
         d = d[:top]
     root = []
     for e in d:
         n = {}
         root.append(n)
         n['l'] = (e.inlinetime, e.callcount, e.totaltime, label(e.code))
         n['c'] = []
         for se in e.calls or []:
             n['c'].append((se.inlinetime, se.callcount, se.totaltime,
                            label(se.code)))
     file.write(ebencode(root))
Example #7
0
def dump_fault(code, msg):
    return ebencode({'y': 'e', 'c': code, 's': msg})
Example #8
0
def dump_fault(code, msg):
    return ebencode({'y':'e', 'c':code, 's':msg})