[Twisted-Python] Are t.w.s.Requests's prepath/postpath part of the IRequest interface?
I was just working on the documentation to fix Trac bug #5533, but I have a question about intent. Right now, prepath and postpath are undocumented; as best as I can tell, though, they are intended to be public. Question is, are they part of the IRequest interface, or only of the Request implementation? (There aren't any other implementations of IRequest in Twisted, so I suppose it's a little bit academic.) It seems to me that they should be on IRequest, since IRequest already has methods like prePathURL() which depend on the information in prepath/postpath. Leaving these attributes off of IRequest wouldn't provide any more flexibility to implementers of the interface, and postpath in particular is very useful to people writing render methods. https://twistedmatrix.com/trac/ticket/5533
On Mar 7, 2019, at 5:42 PM, Wim Lewis
wrote: I was just working on the documentation to fix Trac bug #5533, but I have a question about intent. Right now, prepath and postpath are undocumented; as best as I can tell, though, they are intended to be public. Question is, are they part of the IRequest interface, or only of the Request implementation?
I think that this is a bit of a special case, in that *normally* if something isn’t mentioned in an interface you need to add a new interface, it’s an incompatible change to add it, etc; but, functionally, there are a bunch of things you can’t really implement with the current IRequest unless you assume it has .prepath and .postpath attributes. If someone has an IRequest proxy today it really needs to special case those attributes or it will be unusable for all but the most trivial applications. So yeah: let’s correct the documentation here, and add them.
(There aren't any other implementations of IRequest in Twisted, so I suppose it's a little bit academic.)
Also, yeah, that.
It seems to me that they should be on IRequest, since IRequest already has methods like prePathURL() which depend on the information in prepath/postpath. Leaving these attributes off of IRequest wouldn't provide any more flexibility to implementers of the interface, and postpath in particular is very useful to people writing render methods.
Agreed on all counts.
participants (2)
-
Glyph
-
Wim Lewis