Re: Catching a failed response

2006-06-07 Thread Ivan Sagalaev
Jeremy Dunck wrote: >It sounds to me like "Exception Middleware" needs to be renamed to >"View Exception Middleware" and you should write a patch for "Response >Exception Middleware". ;-) > > I don't think it's possible. In the wsgi.py it's just: return response.iterator .. and the WSGI

Re: Catching a failed response

2006-06-07 Thread Jeremy Dunck
On 6/7/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > What's the current definition of "Exception Middleware"? I can't find > a good one in the docs. From http://www.djangoproject.com/documentation/middleware/#process-exception : " process_exception Interface: process_exception(self, request, exce

Re: Catching a failed response

2006-06-07 Thread Jay Parlar
On 6/7/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > In other words, as it stands, no, I don't think you can catch an > exception raised while sending the bits down the wire. Exception > middleware catches exceptions raised by the view, but the Response > isn't rendered to the pipe until well

Re: Catching a failed response

2006-06-07 Thread Jeremy Dunck
On 6/7/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > Oh wow, you can pass an iterable to HttpResponse? I never noticed that before! > > If the write fails before all the iterations are done though, I guess > I have no way to generically catch that, to do any kind of cleanup I > might need? class M

Re: Catching a failed response

2006-06-07 Thread Jay Parlar
On 6/6/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > Ah... This is interesting :-). A web server will know that a client has > been disconnected only when it will try to send it something. So if you > have a long working view you can't know if it works for nothing until it > finishes. > > It's go

Re: Catching a failed response

2006-06-06 Thread Ivan Sagalaev
Jay Parlar wrote: >What I'd like is that if the client closes their browser, >some exception gets raised, and I can cancel the rest of the process >on the server side. > > Ah... This is interesting :-). A web server will know that a client has been disconnected only when it will try to send it

Re: Catching a failed response

2006-06-05 Thread Jeremy Dunck
On 6/5/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > I think if you're running under mod_python, you want to use > request.connection.aborted in your view function. Sorry, mod_python reference here: http://www.modpython.org/live/current/doc-html/pyapi-mpconn-mem.html#l2h-134 --~--~-~--~-

Re: Catching a failed response

2006-06-05 Thread Jeremy Dunck
On 6/5/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > I update the status of the process by using some simple AJAX from the > client side. What I'd like is that if the client closes their browser, > some exception gets raised, and I can cancel the rest of the process > on the server side. Interestin

Re: Catching a failed response

2006-06-05 Thread Jay Parlar
On 6/5/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Can't you use an "onUnload" event handler for that? I think that's what > Google Mail also uses for discarding message drafts that you're working > on when you close the browser window. > > As the other poster already pointed out: just beca

Re: Catching a failed response

2006-06-05 Thread [EMAIL PROTECTED]
Jay Parlar wrote: > I update the status of the process by using some simple AJAX from the > client side. What I'd like is that if the client closes their browser, > some exception gets raised, and I can cancel the rest of the process > on the server side. Can't you use an "onUnload" event handler

Re: Catching a failed response

2006-06-05 Thread Jay Parlar
On 6/5/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > What's the issue or objective? Even if you push some bits down the > pipe, there's no guarantee the browser got them or rendered them > correctly. Maybe understanding your motivation would help provide a > useful answer. > > But, for a short a

Re: Catching a failed response

2006-06-05 Thread Jeremy Dunck
On 6/5/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > But even in the production setup, will their be an exception raised > that I can get my hands on, or will mod_python silently swallow it? What's the issue or objective? Even if you push some bits down the pipe, there's no guarantee the browser g

Re: Catching a failed response

2006-06-05 Thread Jay Parlar
On 6/5/06, James Bennett <[EMAIL PROTECTED]> wrote: > > On 6/5/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > > When I run with the development server, I just get a 'Broken pipe' > > socket error. I'm guessing the situtation will be even worse when I > > try with Apache/mod_python. > > I personally h

Re: Catching a failed response

2006-06-05 Thread James Bennett
On 6/5/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > When I run with the development server, I just get a 'Broken pipe' > socket error. I'm guessing the situtation will be even worse when I > try with Apache/mod_python. I personally haven't noticed anything bad happening. It's generally not a good

Catching a failed response

2006-06-05 Thread Jay Parlar
Let's say that a client requests a page, and before the view can send a response, the client closes their browser. Is there any way in Django to catch an Exception for that? When I run with the development server, I just get a 'Broken pipe' socket error. I'm guessing the situtation will be even w