(user_id)
return (
        set([user_id]) 
        |set(row.from_user for row in rows)
        | set(row.to_user for row in rows)
    )
return a list of ids of friends (included user_id self)
return a list of ids of friends (included user_id self)
return a list of ids of friends ( included user_id self )
def friend_ids(user_id):
    """return a list of ids of friends (included user_id self)"""
    query = db.friend_request.status == "accepted"
    query &= (db.friend_request.to_user == user_id) | (
        db.friend_request.from_user == user_id
    )
    rows = db(query).select()
    return (
        set([user_id]) 
        |set(row.from_user for row in rows)
        | set(row.to_user for row in rows)
    )
def friend_ids ( user_id ) : query = db . friend_request . status == "accepted" query &= ( db . friend_request . to_user == user_id ) | ( db . friend_request . from_user == user_id ) rows = db ( query ) . select ( ) return ( set ( [ user_id ] ) | set ( row . from_user for row in rows ) | set ( row . to_user for row in rows ) )