[Twisted-Python] RFC : Test implementation. Need comments

Thomas Weholt 2002 at weholt.org
Sun Jul 6 19:43:57 EDT 2003


To get the hang of Twisted I've tried to port an old BaseHTTPServer-based
project, or at least parts of it. It loads dynamic pages, ie. Twisted
Resources, dynamically. It's *very* crude and ugly code, but I just would
like to get some comments to see if I'm on a totally wrong track here.

It's been a couple of days since I wrote the code and I've had time to
implement another, more complete version, with XML-RPC support, modules with
RPC-methods loaded dynamically also. Will include SOAP support very soon. It
also "solves" the problem of what to put where when deplyoing Twisted-web
applications; I've created a folder structure looking like this :

1. wwwroot/pages -> modules for dynamic pages, ie. subclassing Resource
2. wwwroot/static -> images and other static content
3. application/data -> all data, like database files etc. are stored here
4. application/config -> all config files are stored here. Using INI-files
for now, dynamically loaded into the service object
5. application/rpc -> modules with rpc-methods, available in both XML-RPC
and SOAP at the same time. Loaded dynamically
6. application/businessobjects -> objects solving logic and storing/loading
data, loaded dynamically, available to and used by rpc-classes and dynamic

( the version online does not use this structure, but something simpler )

My latest version uses mainly the same method to load all the other
dynamically loaded stuff, so the version online will give you an idea of
what I'm doing. If my first attempt available now is not totally off, I'll
make the next version available sometime tomorrow. If not I'll take the
comments on this one and re-write the current implementations based on ideas
or comments from the list.

The files are available at :
Extract them into your python-path and start the file in the

For now what I'm mainly looking for is a cleaner, more Twisted way of
loading the page-Resources and how to use the Twisted-Service-class
properly. For now it holds all configuration data in the entire application,
rpc-methods, businessobjects available for the entire application and later
it will hold some scheduled method-calls to dynamically loaded objects doing
specific tasks. I do not know if this is the proper way to do this.

Best regards,

More information about the Twisted-Python mailing list