I was wondering if there's any way to support this style of coding in ASP/Python.
This works in VBScript (but I'm trying to remove all my VBScript), but I seem to be getting hit by the fact that each block of code is being analyzed as a single block of code and the "if" not being able to span multiple code blocks. #VBScript <% If This = "THAT" Then Response.Write("BEFORE") %> This does == THAT<BR> <!-- #include virtual="/inc/whatever.vbscriptincludefile" --> <% Response.Write("AFTER<BR>") End If %> What I am trying to show you is that in VBScript, an IF block can span the multiple code regions (<% code %>) and conditionally display the HTML in between the IF and END IF if the condition matches Note that in VBScript if This = "THAT", this VBScript would display: BEFORE<BR> This does == THAT<BR> *** whatever the include file displayed AFTER<BR> And of course, if This <> "THAT" it wouldn't display anything from above! However in Python, and a similarly structured code-block: #Python <% if This == "THAT": Response.Write("BEFORE<BR>") %> This does == THAT<BR> <!-- #include virtual="/inc/whatever.pythonincludefile" --> <% Response.Write("AFTER<BR>") %> In python, We would get (if This == "THAT"): BEFORE This does == THAT<BR> *** and whatever the include file displayed (if the include file had no additional logic to filter the data) AFTER<BR> However, in python, we would get (if This != "THAT"): This does == THAT<BR> *** and whatever the include file displayed (if the include file had no additional logic to filter the data) AFTER<BR> Lastly, if I indent the Response.Write("AFTER<BR>") in this second code block to try and span the code block to the same conditional started in the first code block, I get a syntax error like this: unexpected indent /folder/somefile.asp, line ### Response.Write("AFTER<BR>") ---^ is there any way around this without doing a lot of other if blocks in each section of <% code %> It sounds like an RFE to me (and probably not an easy one), but maybe I'm missing something? IIS on W2016 (most recent patches) Activestate Python: 3.8.2 pywin32==227 Please and Thank You, Steven _______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32