Win32 ASP Problems (Response.End)
Mark Hammond
mhammond at skippinet.com.au
Fri May 31 01:58:53 EDT 2002
Jim Abrams wrote:
> All sorts of weird flakiness abounds.
>
> File 1:
>
> <%@LANGUAGE="Python"%>
> <%
> Response.End()
> %>
> End of Line.
>
> This shows "End of Line." on the page. Response.End() seems to pass
> through.
By "pass through", I assume you mean "execute"?
> File 3:
> <%@LANGUAGE="Python"%>
> Between Text
> <%
> Response.end()
> %>
Unfortunately, we seem to be seeing a combination of factors:
* Response.end appears to actually be *calling* Response.End() - even
without the parens. This is a side-effect of the way Python queries
objects for their properties. This actually shouldn't be happening -
Response.end should raise an AttributeError. I will look into this, but
have spent too much time on AXScript already this week!
* After Response.End() has been called, it appears that the
ActiveScripting engine no longer bothers to fetch exception information.
For example:
<%
Response.End()
raise ValueError, "Foo"
%>
does not report the exception. If we simply remove the Response.End()
call, we find the exception *is* reported normally. It appears that
this is a feature of ASP rather than Python. For example, if you use
VBScript code:
<%
Response.End()
a = 1/0
%>
You will get the same result as you got for Python (ie, no error details
reported). If you remove the call to Response.End(), then you will see
the VBScript exception in the browser.
So, your code:
Response.end()
Ends up doing:
1) temp = Response.end
2) temp()
As mentioned above, 1) has the effect of *calling* Response.End(), and
as this function returns nothing, temp is set to None. 2) then attempts
to call None, but as Response.End() has been "called", ASP itself eats
the reported exception.
FWIW, I have a new ActiveScripting engine that fixes the ASP refresh
problem, and should also make ASP much faster when re-displaying the
same page (as the script code is not parsed each time, but reused from
the last time). Mail me if you would like to test this out.
Mark.
More information about the Python-list
mailing list