Hi,

I'm trying to build a table where each a <td> is only created if it has a 
value and the width is determined by a predetermined percentile that exists 
in the row  This is what I have:

<table width=100%>
    <tr>
        <td>Vulnerability Count</td>
    </tr>
    {{for row in summary:}}
    <tr>
        <td>{{=row.nessus_hosts.name}}</td>
        {{if not row.nessus_host_summary.critprct == '0':}}
        {{print "<td width=%s bgcolor=#CC0000>%s</td>" % 
(row.nessus_host_summary.critprct, row.nessus_host_summary.count_crit}}
        {{pass}}

        {{if not row.nessus_host_summary.highprct == '0':}}
        {{print "<td width=%s bgcolor=#FF9900>%s</td>" % 
(row.nessus_host_summary.highprct, row.nessus_host_summary.count_high}}
        {{pass}}

        {{if not row.nessus_host_summary.medprct == '0':}}
        {{print "<td width=%s bgcolor=#FFD119>%s</td>" % 
(row.nessus_host_summary.medprct, row.nessus_host_summary.count_med}}
        {{pass}}

        {{if not row.nessus_host_summary.lowprct == '0':}}
        {{print "<td width=%s bgcolor=#2EB82E>%s</td>" % 
(row.nessus_host_summary.lowprct, row.nessus_host_summary.count_low}}
        {{pass}}

        {{if not row.nessus_host_summary.infoprct == '0':}}
        {{print "<td width=%s bgcolor=#3083D6>%s</td>" % 
(row.nessus_host_summary.infoprct, row.nessus_host_summary.count_info}}
        {{pass}}
    </tr>
    {{pass}}
</table>

This gives me the following exception:

Traceback (most recent call last):
  File "C:\Users\jensenn\web2py\gluon\restricted.py", line 223, in restricted
    ccode = compile2(code, layer)
  File "C:\Users\jensenn\web2py\gluon\restricted.py", line 206, in compile2
    return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, 'exec')
  File 
"C:\Users\jensenn\web2py\applications\rsoapps\views\segsecurity/index.html", 
line 52
    response.write('\r\n        ', escape=False)
           ^
SyntaxError: invalid syntax


I'm looking at the TABLE, TR, and TD helpers in the book, but to be honest 
I cant see where I can set the width for each TD item.
Can anyone advise what I'm doing wrong?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to