Help! IIS and Python

Tim Roberts timr at probo.com
Sat Feb 16 23:43:09 EST 2002


gbreed at cix.compulink.co.uk wrote:
>
>> Since we're on the subject of Python in ASP programming, how do you use 
>> the <%=xxx%> trick with indentation?  This fails with an indentation 
>> error, for example:
>> 
>> <%
>> for i in range(5):
>> %>
>>   <%="aaa%d" % i %>
>
><%
>formatter = """
>  aaa%d
>"""
>
>for i in range(5):
>  Response.Write(formatter%i)
>%>
>
>Why not?

We're diving deeply into religion and philosophy here.  Partly, it's just
the principle of the thing; I assumed there was a magic method to do this
with Python, but I'm coming to the conclusion that there is not.  The
"Response.Write" call seems extraneous to me; VBScript and JScript forms
can omit it with the <%= trick, as if we could write this:

...
for i in range(5):
%>
  <%= formatter % i %>

Perhaps the issue is that I don't know how the <%= form is actually
implemented in Python/ASP.  If it is just a textual substitition, where the
<%= ... %> is replaced with Response.Write(...) by simple textual
substitution, then I understand why it is not possible.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list