(viewmode, hdrItems, content, limit, logfunc)
return " ".join(msg), ret[1]
Returns a (msg, body) tuple.
Returns a (msg, body) tuple.
Returns a ( msg body ) tuple .
def get_content_view(viewmode, hdrItems, content, limit, logfunc):
    """
        Returns a (msg, body) tuple.
    """
    if not content:
        return ("No content", "")
    msg = []

    hdrs = flow.ODictCaseless([list(i) for i in hdrItems])

    enc = hdrs.get_first("content-encoding")
    if enc and enc != "identity":
        decoded = encoding.decode(enc, content)
        if decoded:
            content = decoded
            msg.append("[decoded %s]"%enc)
    try:
        ret = viewmode(hdrs, content, limit)
    # Third-party viewers can fail in unexpected ways...
    except Exception, e:
        s = traceback.format_exc()
        s = "Content viewer failed: \n"  + s
        logfunc(s)
        ret = None
    if not ret:
        ret = get("Raw")(hdrs, content, limit)
        msg.append("Couldn't parse: falling back to Raw")
    else:
        msg.append(ret[0])
    return " ".join(msg), ret[1]
def get_content_view ( viewmode , hdrItems , content , limit , logfunc ) : if not content : return ( "No content" , "" ) msg = [ ] hdrs = flow . ODictCaseless ( [ list ( i ) for i in hdrItems ] ) enc = hdrs . get_first ( "content-encoding" ) if enc and enc != "identity" : decoded = encoding . decode ( enc , content ) if decoded : content = decoded msg . append ( "[decoded %s]" % enc ) try : ret = viewmode ( hdrs , content , limit ) # Third-party viewers can fail in unexpected ways... except Exception , e : s = traceback . format_exc ( ) s = "Content viewer failed: \n" + s logfunc ( s ) ret = None if not ret : ret = get ( "Raw" ) ( hdrs , content , limit ) msg . append ( "Couldn't parse: falling back to Raw" ) else : msg . append ( ret [ 0 ] ) return " " . join ( msg ) , ret [ 1 ]