From: Ian B. <ia...@co...> - 2004-04-22 19:13:26
|
Matt Feifarek wrote: > Ian Bicking wrote: > >> Actions are always -- that's what defaultAction is there for. > > I don't think so. Actions only happen when there's _action_XXX in the > request. But maybe you've changed this behavior. I don't think this is new to CVS, but I don't have a copy of 0.8.1 handy, and CVS history still scares me ;) It's at the end of Page.respond, where if no actions are found it calls defaultAction -- which is different than other actions, because it doesn't go through handleAction, and thus doesn't call preAction and postAction, but that's just cruftiness anyway. >> from Servlet.py (CVS): >> > Great! But this is not what is in the current version. I was talking > about the problem with the current version, and inconsistent use of > sleep. People who aren't comfortable running production servers on CVS > are out of luck. Yes, that sucks. A lot of these things can be handled in 0.8 in more crufty ways, or by backporting small bits (like the addition of runTransaction, which is a pretty small change). > But, it does look way better. I'm looking forward to being able to take > advantage of it. > >> You can change this fairly easily since it's a method of Servlet now, >> and not Application. EndResponse and other exceptions from >> HTTPExceptions are still handled by Application > > > We're still not ending the response. We're still sending a response. > It's shorter, yes, but we're still doing it. "End" is the wrong metaphor. We are sending a response, but at the same time we're ending the response. Once you've sent the redirect there's no point ot sending anything else. In 0.8 way you would change sendResponseAndEnd to call sleep and then raise EndResponse. Either way. (Personally, I think it makes more sense to raise HTTPTemporaryRedirect, which makes it clear at the point of redirect that you're jumping out of the rest of the request -- putting the exception in sendResponseAndEnd makes hides that important part of the implementation) >> You need some way of dealing with this -- if sleep has to be cautious >> about how it is called, then so be it; *something* has to be cautious. >> There's always a possiblity of exceptions -- if you don't > > > Good point. I agree. > >> A lot of good things come out of exceptions that can't come from >> flags. You can raise permission > > > I agree with you. Exceptions are better. Especially if they don't > disrupt awake and sleep (as you've written above). > > I supose we have to let someone disrupt response, but then you have the > possibility of having sent data to a stream that is never sent, which is > weird. An example: we use a "messages" and "errors" pattern, much like > what's in your sandbox. We pop them from a list in session and send them > in writeHTML. If they get sent, and *then* the response is converted > into a redirect, the message is lost. This is why response should be > either/or. Yes, I've thought about that issue. Generally I never redirect after I'm part way through rendering a page, but other people might want to do that. There should be a way to detect that the output is being thrown away. Using the component stuff you actually could get an exception event, and perhaps infer that the output is being thrown away. >> flag, only that we could. Right now I've been working on user >> management components (svn://w4py.org/LoginKit), and a more formalized >> way to control output seems necessary to > > > I like the sound of that. I'll try and look at your code. > |