Pythonic way of web-programming

Ian Bicking ianb at colorstudy.com
Sun Apr 13 01:06:54 EDT 2003


On Sat, 2003-04-12 at 15:39, Alex Martelli wrote:
> A Webkit version running on top of Twisted would really be a wonderful
> thing to have... I have a hard time conceiving of exactly how you'd fit
> them together (maybe I'm not familiar enough with the _internals_ of
> each, though I've used them both), but I'll accept your assessment that
> it would be a pretty easy job for you, so, what about trying it out...?

It should be pretty simple, really.  WebKit has a single entry point
that takes an argument with the CGI-like variables for the request, an
input stream (e.g. for the POST data), and an output stream (with a
write method) that accepts CGI-like output (i.e., it may add headers,
translate Status into a response code, etc. -- but simple stuff).  This
entry point is expected to run in a thread of its own.

Using the Twisted CGI code, it would be a quick change to make it
dispatch to a thread instead of a process (as with CGI).

The other detail is initializing the WebKit environment -- the
persistent Application object, plugins, etc.  That would be easy to do
in a simplistic way, maybe more subtle if I was to use a more Twisted
way.

I'm still thinking about the strategy around it, which is why I haven't
actually tried implementing it.  As an experiment it's not that
interesting to me, but maybe it could be more than that.

  Ian







More information about the Python-list mailing list