[Twisted-web] How to handle interrupted responses in nevow?

Peter Westlake peter.westlake at pobox.com
Fri Oct 15 15:50:39 EDT 2010



On Fri, 15 Oct 2010 19:03 +0000, exarkun at twistedmatrix.com wrote:
> On 04:52 pm, peter.westlake at pobox.com wrote:
> >A quick question about Python style:
> >
> >nevow.Request is a subclass of twisted.web.server.Request,
> >which is a subclass of http.Request, which has an attribute
> >_disconnected. Since the name begins with an underscore, it
> >isn't intended to be part of the public API, and I think
> >that means I can't refer to it in nevow.Request.
> >
> >There are two options:
> >
> >1) use notifyFinish() to set a new attribute in nevow.Request,
> >   which would end up duplicating _disconnected;
> >
> >2) use it anyway, and file a request for _disconnected to
> >   become part of the published interface.
> >
> >Both approaches work, and I have a unit test to prove it!
> >Which would you like me to do?
> 
> A combination of the two sounds best to me.  Use `notifyFinish` for now, 
> and file a ticket asking for a public version of `_disconnected`.  When 
> that's done and has been released for long enough, Nevow can switch (if 
> anyone cares enough to do it - presumably the only reason anyone would 
> care is that using `notifyFinish` might add a miniscule additional 
> amount of per-request overhead).

In that case, I have a patch (attached). You also mentioned that
handleSegment would need fixing: under what circumstances does
that go wrong?

Peter.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: avoid-request-finish-error.patch
Type: application/octet-stream
Size: 2150 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20101015/b469c609/attachment.obj 


More information about the Twisted-web mailing list