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 ModPythonHandler(BaseHandler): def __call__(self, req): ... populate_apache_request(response, req) def populate_apache_request(http_response, mod_python_req): "Populates the mod_python request object with an HttpResponse" ... for chunk in http_response.iterator: mod_python_req.write(chunk) 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 after that. 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". ;-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---