[Twisted-Python] Small woven application example

Stephen Thorne. stephen at thorne.id.au
Mon Sep 15 19:17:15 MDT 2003


Hi.

I did some hacking with twisted.web and woven, just to try and teach myself 
how to go about writing a web application using twisted, bearing in mind I 
write php in my day job, this was a little hard.

http://thorne.ath.cx:3000/~stephen/wikiexample.xhtml
is the result of my efforts, and you can see it running at 
http://thorne.ath.cx:8081/MainPage/

I've got there the original code I started with (using Resource and a fairly 
phpish methodology) and what I finished with.

In my little venture back into the realm of twisted, I see the following 
lacking in the documentation:

 * The varied Views and Widgets are poorly documented, I found myself 
inventing what was needed, then going into Twisted/twisted/web/woven/ and 
reading widgets.py and view.py - and discovering that they already existed.

 * There is very little mapping between "This is how you would do it in a 
silly framework" -> "This is how twisted makes it cleaner and easier"

 * The pitfalls.
	* e.g. For submitting forms and the implicit header "Location:" redirects 
which obliterate your post values. (When you have <form action="/Foo/bar">, 
but you'll get redirected to "/Foo/bar/")
	* the interface to the factories should be written down on a piece of card 
and stuck to the monitor. Swapping 'request' and 'model' doesn't help things.

As such, I intend to go through all the views and widgets, and write a small 
example piece of code, showing what each of them does, and what 
inputs/outputs they take. I also intend to take some php idioms and show a 
mapping from them to twisted.

Fortuantely, I've got loads of experience with lore (I recently used it to 
typeset a 90+ page tutorial for a camp I'm leading on in 2 weeks, 
http://thorne.ath.cx:3000/lwdoc/index.xhtml if you're interested)

Please send replies CC: stephen at thorne.id.au as I'm not currently subscribed 
to the list.

Regards,
Stephen Thorne





More information about the Twisted-Python mailing list