<%@ 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

%>

<html>
<head>
<title>Python with ASP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF">
<h3>Simple Demo of Python with ASP </h3>
<p>Here a calculated string from Python:<i> <%= glob.hello %> </i></p>
<p>Table generated with Python &amp; ASP, editable with Wysiwyg editor </p>
<table border="1" width="100%">
  <tr> 
    <td bgcolor="#FFCC00"> <%
if 0: 
  render("""%>first column header<%""")
else:
  render("""%> <%= glob.colhead_1 %> <%  """)%> </td>

<%
for col in range(1, ncols+1):
  glob.colno = col
  render("""%> <td bgcolor="#FF66FF" align="CENTER"> <%""")
  if 0: render("""%>other column headers<%""")
  else: render("""%> 
<%= "head %d is here" % glob.colno %> 
<%      """)
  render("""%> </td> <%""")%>
  </tr>
<%
for row in range(1, nrows+1):
  glob.rowno = row
  render("""%> <tr> <%""")
  render("""%> <td bgcolor="#FFFF33"> <%""")
  if 0: 
    render("""%>first column body<%""")
  else: 
    render("""%> <%= "row %d" % glob.rowno %> <%  """)
  render("""%> </td> <%""")

  for col in range(1, ncols+1): 
    glob.colno=col
    render("""%>
    <td bgcolor="#66CC00" align="CENTER"><%""")
    if 0: render("""%>other column bodies<%""")
    else: render("""%> 
<%= "row %d col %d" % (glob.rowno, glob.colno) %> 
<%    """)
    render("""%></td>
    <%""")

  render("""%></tr><%""")
%>
</table>
<p><font size="-1">Christian Tismer<br>Professional Net Service GmbH<br>
  <a href="mailto:tismer@pns.cc"><i>email:tismer@pns.cc</i></a> </font><br>
</body>
</html>