I am trying create a representation of a computer rack using genshi in TG2.
What I am trying to do is
loop through the rack elevations and when I find an elevation where a host
belongs, I want to add some
data to show a host is at that spot. Thats the easy part. I also want to
modify the rowspan for the <td>
element so that the host <td> spans the appropriate number of elevations to
show the vertical size of
the machine.

I've done this using PHP but have long since decided to rewrite my project
in Python/TG. Now I am
finding that i am somewhat limited in what i can achieve with immutable
variables.

Basically, I need this..

temp=0
print "<TABLE>"
print "<TR><TD>row</TD><TD>rack.rackid</TD><TD>row</TD></TR>"
for(row=1; row<43; row++)
   for host in hostlist:
     if host.elevation == row:
         uspan = host.height-1
         print "<TR><TD>row</TD><TD
rowspan=uspan>host.hostname</TD><TD>row</TD></TR>"
         while temp > 0 :
           row++
           print "<TR><TD>row</TD><TD>row</TD></TR>"
           uspan--
   else
         print "<TR><TD>row</TD><TD></TD><TD>row</TD></TR>"

print "<TR><TD>row</TD><TD>PDU</TD><TD>row</TD></TR>"
print "<TR><TD>row</TD><TD>PDU</TD><TD>row</TD></TR>"


The above (really ugly) pseudo-code mashup tries to explain it



Does anyone here know of a way I can do this using genshi?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

<<attachment: Screenshot.png>>

Reply via email to