Problems with python in asp

Joshua Macy amused at webamused.com
Tue Mar 7 20:09:48 EST 2000


anderbj at my-deja.com wrote:
> Finally here's the prob.
> 
> <%@ LANGUAGE = Python %>
> <%
> 
> import string
> 
> %>
> 
> <%
> category = Request.QueryString("cat")
> if category == "mainmenu":  #Line 10
> %>
>  <TITLE><%= category %></TITLE>
> <%
> else:
> %>
>  <TITLE><%= category %></TITLE>
> 
> The variable category contains the parameter (I've used the win32traceutil
> to confirm that).
> This code generates the errormsg below. I've tried several different ways to
> cope with this prob, and two problems keep coming up:
> I can't check if category equals "somestring" and there is problems with the
> if condition.


  I may be barking up the wrong tree entirely (I haven't tried Python in
ASP yet), but it appears to me that stripped of the ASP cruft, your
Python routine looks like:

category = Request.QueryString("cat")
if category == "mainmenu":
	= category
else:
	= category


Which is indeed invalid syntax, and the line identified as the invalid
line when I try this interactively is the one with the if statement. 
Try making both branches legal Python (even if it doesn't do exactly
what you want at first) and see if you still have the problem.

Joshua



More information about the Python-list mailing list