'Provide a Human-readable representation of Audit records
- currently unused
@param record: the record IDs'

def represent(self, records):

    table = self.table
    if isinstance(records, int):
        limit = 1
        query = (table.id == records)
    else:
        limit = len(records)
        query = table.id.belongs(records)
    records = current.db(query).select(table.tablename, table.method, table.user_id, table.old_value, table.new_value, limitby=(0, limit))
    s3db = current.s3db
    output = []
    oappend = output.append
    for record in records:
        table = s3db[record.tablename]
        method = record.method
        if (method == 'create'):
            new_value = record.new_value
            if (not new_value):
                continue
            diff = []
            dappend = diff.append
            for v in new_value:
                (fieldname, value) = v.split(':', 1)
                represent = table[fieldname].represent
                if represent:
                    value = represent(value)
                label = (table[fieldname].label or fieldname)
                dappend(('%s    is    %s' % (label, value)))
        elif (method == 'update'):
            old_values = record.old_value
            new_values = record.new_value
            if (not new_value):
                continue
            changed = {}
            for v in new_values:
                (fieldname, new_value) = v.split(':', 1)
                old_value = old_values.get(fieldname, None)
                if (new_value != old_value):
                    type = table[fieldname].type
                    if ((type == 'integer') or type.startswith('reference')):
                        if new_value:
                            new_value = int(new_value)
                        if (new_value == old_value):
                            continue
                    represent = table[fieldname].represent
                    if represent:
                        new_value = represent(new_value)
                    label = (table[fieldname].label or fieldname)
                    if old_value:
                        if represent:
                            old_value = represent(old_value)
                        changed[fieldname] = ('%s    changed    from    %s    to    %s' % (label, old_value, new_value))
                    else:
                        changed[fieldname] = ('%s    changed    to    %s' % (label, new_value))
            diff = []
            dappend = diff.append
            for fieldname in changed:
                dappend(changed[fieldname])
        elif (method == 'delete'):
            old_value = record.old_value
            if (not old_value):
                continue
            diff = []
            dappend = diff.append
            for v in old_value:
                (fieldname, value) = v.split(':', 1)
                represent = table[fieldname].represent
                if represent:
                    value = represent(value)
                label = (table[fieldname].label or fieldname)
                dappend(('%s    was    %s' % (label, value)))
        oappend('\n'.join(diff))
    return output
