[Twisted-Python] HTML shoudl not be baked into twisted.web HTTP implementation

Jared Gisin jared.gisin at isilon.com
Wed Dec 9 11:52:33 EST 2009

I'm writing a HTTP server that exposes various resources as an API.
Unless I'm missing something, twisted's HTTP protocol implementation is
in twisted.web.http. 


The problem with this package is that it's inexplicably wrapped up in
HTML. HTML has nothing to do with HTTP as a whole. Sure, HTML is often
what HTTP requests return, but there's no reason why it should nor is
there any RFC that says it should. HTTP request can return anything.


The software I'm writing is a programmatic interface. One never uses a
web browser, so things such as displaying tracebacks
(twisted.web.util.formatFailure) in HTML format is completely wrong.
When implementing HTTP, why assume the client always wants HTML. It seem
completely wrong from these modules and libraries to be so full of HTML
output. HTML output should be provided as a separate config or option
for twisted.web. In this case, why not just dump the traceback directly
to the HTTP entity-body? As a consumer of twisted.web, I  should not
have to battle with the hard-coded HTML output of this library. If I
want the library to dump things in HTML output, I should have an option
to tell it to do that (and I should be able to better customize the
HTML), but I should not get HTML by default. 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20091209/2a0df985/attachment.htm 

More information about the Twisted-Python mailing list