Introduction

Twisted

Prerequisites

In order to follow this tutorial and run the example, you will need to download and install the latest version of twisted from cvs. Also, as Twisted is on the bleeding edge of Python development, you should be running the latest official release from www.python.org.

Twisted is being aggressively developed and improvements and bugfixes are being made on a daily basis, so it would behoove you to have the latest copy. To download the source from anonymous cvs:

    $ cvs -d:pserver:anon@cvs.twistedmatrix.com:/cvs login
    CVS Password:   #(Just press enter)

    # NOTE: the -z6 is *IMPORTANT* as we're getting the server for free!
    $ cvs -z6 -d:pserver:anon@cvs.twistedmatrix.com:/cvs co Twisted

then run the install program

    $ cd Twisted
    Twisted $ python2.3 setup.py install

What is Woven?

Overview

Woven is a framework for building web applications using Python and the Twisted framework. It is designed to allow a programmer to separate the web skinning html, from the application logic. This has always been a problem when using JSP or ASP, as careless web designers can easily break the logic that's co-mingled with the html. Woven allows your web designers to design to their heart's content, and not worry about breaking something important. Another goal of Woven is to allow pages to be composable, large complex pages are able to be constructed out of many small independent parts which have no knowledge of each other. This greatly improves code-reuse, makes debugging simpler, and allows for a high degree of flexibility.

Woven is a nice way of building powerful web applications using Python, that integrate seamlessly with the Twisted web server.

Required Reading

Before you go through this tutorial, I highly recommend you read the Twisted Woven How-To, it was invaluable in writing this tutorial. It will explain some things in much more depth than I will cover here. It would also be of great use to you to know how the http protocol works, especially the request/response cycle.

Tutorial Structure

The topic at hand is broad and deep, there's a lot in here to get familiar with and to understand. I'll be taking you through an example application, and I'll do my best to do it in a logical fashion. Before each section, I'll explain breifly the topics we'll cover, and give an overview of the program flow through the code we're going to be looking at. Then there'll be a code listing, and discussion about each method and what it does. The application will be available to you , so I reccomend that you play with it while reading this. Feel free to borrow and steal and improve from this source, it was written for your benefit, so make use of it.

next prev toc