[Twisted-Python] Does anybody have a working project ...

Jonathan Lange jml at ids.org.au
Fri Jul 4 00:03:22 EDT 2003


On 2003.07.04 08:59, Thomas Weholt wrote:

> Demanding request? Sorry, but I got a bunch of working, yet blocking
> and non-Twisted-friendly code lying around which could be of interest 
> to people

Kind of. You don't really need a single project that has all six of 
your desires, as each is more or less independent. In fact, each of 
these pieces is pretty simple. 
If your problem lies in figuring out how to stick them all together, 
you will need to be more specific in what you are trying to do.

> 1. don't use rpys, but Site and Application

RPYs and Site / Application are two ways of going about the same thing.
In Issues, you will notice that issues/tap/web.py uses Site / 
Application to create a web server.

Although Issues comes with an RPY, it doesn't need one.

> 2. starts a service which holds some persistent data and does a 
> scheduled call to a long-running, blocking method once a while

Lots of stuff does persistent data. Issues uses world. 
A scheduled call to a blocking method could probably be done quite 
simply using deferToThread and callLater. (Some t.internet expert 
should confirm this). The "Scheduling" howto may help with this.

> 3. implements some kind of authentication

Again, Issues uses it's own kind of authentication, rather than any 
implementation of cred. This is mainly because my brain obstinately 
refuses to understand guard. 
Divmod uses cred and guard for authentication.

> 4. use Woven

Issues, Plonk, Divmod, Blog.

> 5. hopefully has some way of keeping the same design for all it's
> pages, using a master template and populating it with data at run-
> time or something similar

Someone here has suggested using ExpandMacro for this. I have steered 
clear of this in Issues, being content to copy-and-paste the basic 
layout of each page. (Although much of the content is shared)

> 6. it would be nice if it also showed how to dynamically add pages
> subclassing Woven.Page using putChild if these pages was in a given
> folder.

getDynamicChild is your friend! It is demonstrated in almost every 
existing Woven application (including Issues)

Hope this helps,
jml




More information about the Twisted-Python mailing list