

def DeferredSerializer(original, context):
    '\n    Serialize the result of the given Deferred without affecting its result.\n\n    @type original: L{defer.Deferred}\n    @param original: The Deferred being serialized.\n\n    @rtype: L{defer.Deferred}\n    @return: A Deferred which will be called back with the result of\n        serializing the result of C{original} or which will errback if\n        either C{original} errbacks or there is an error serializing the\n        result of C{original}.\n    '
    d = defer.Deferred()

    def cb(result):
        d2 = defer.maybeDeferred(flat.serialize, result, context)
        d2.chainDeferred(d)
        return result

    def eb(error):
        d.errback(error)
        return error
    context.addCallbacks(cb, eb)
    return d

dataset/ETHPy150Open twisted/nevow/nevow/flat/twist.py DeferredSerializer/VarMisuse@77/254 `original`->`context`