<%
from cgi import escape

tc = c.tcnx.cursor()
tnc = c.tcnx.ncursor()
extlinq = "SELECT attr, value FROM trio_x_lin_%s WHERE aid = %s" % (c.tables[0], c.aids[0])
tnc.execute(extlinq)
t = tnc.fetchall()
%>

<table>
% for pair in t:
    <tr>
    <td><strong>${pair[0]}:</strong></td>
    <td>
    <%
    if isinstance(pair[1], str):
        val = escape(unicode(pair[1], 'utf-8'), True)
    else:
        val = pair[1]
    %> 
    % if pair[0] == 'url' and isinstance(val, basestring):
        <a href="${val}" title="${val}">${val[:32]}[...]</a>
    % else:
        ${val}
    % endif
    </td>
    </tr>
% endfor
</table>

<%
session.save()
%>
