%@ LANGUAGE = Python %> <% # Utilities import string def render(s): code = string.replace(s, " Response.", "\nResponse.")+"\n" exec code def encode(s): return Server.HTMLEncode(str(s)) def encurl(s): return Server.URLEncode(str(s)) # a lot more goes here, left out for the news group sample class glob: pass # provide easy access to global namespace glob.hello = "Hello from Python" glob.colhead_1 = "column with labels" ncols = 4 nrows = 10 %>
Here a calculated string from Python: <%= glob.hello %>
Table generated with Python & ASP, editable with Wysiwyg editor
| <% if 0: render("""%>first column header<%""") else: render("""%> <%= glob.colhead_1 %> <% """)%> | <% for col in range(1, ncols+1): glob.colno = col render("""%><%""") if 0: render("""%>other column headers<%""") else: render("""%> <%= "head %d is here" % glob.colno %> <% """) render("""%> | <%""")%>
| <%""") if 0: render("""%>first column body<%""") else: render("""%> <%= "row %d" % glob.rowno %> <% """) render("""%> | <%""") for col in range(1, ncols+1): glob.colno=col render("""%><%""") if 0: render("""%>other column bodies<%""") else: render("""%> <%= "row %d col %d" % (glob.rowno, glob.colno) %> <% """) render("""%> | <%""") render("""%>
Christian Tismer
Professional Net Service GmbH
email:tismer@pns.cc