def s3_rheader_resource(r):
    """
        Identify the tablename and record ID for the rheader

        @param r: the current S3Request

    """

    _vars = r.get_vars

    if "viewing" in _vars:
        try:
            tablename, record_id = _vars.viewing.rsplit(".", 1)
            db = current.db
            record = db[tablename][record_id]
        except:
            tablename = r.tablename
            record = r.record
    else:
        tablename = r.tablename
        record = r.record

    return (tablename, record)

# =============================================================================
dataset/ETHPy150Open sahana/eden/modules/s3/s3navigation.py/s3_rheader_resource/original