[Twisted-Python] Storing site-wide information and scheduling tasks

Thomas Weholt ( PRIVAT ) 2002 at weholt.org
Thu Jun 26 09:50:22 EDT 2003


[snip]

> Are you intending on pre-defining all the tasks the user might want to
use,
> or are you expecting users to want to plugin random code?

What I'm making now is a sceleton for a IMHO *very* dynamic server :
1. pages ( ie. Resource-classes ) will be loaded at startup. They're located
in a specific folder. Nothing will be hardcoded. Each module can have
N-number of classes subclassing Resource and if they have a render-method it
will be added to the server. Something like :
/pages/test.py -> contains classes hello and goodbye which again have a
render method, will become available on the server as /test/hello.html and
/test/goddbye.html
I'm writing my own class to produce the content, which takes request,
response and server as parameter to the render-method, where server is a
persistent-data-holder and response is a object in which you store content,
content-type etc. which again will be used to produce the actual content
sent to server. Using request.write is for mye counter-intuitive, since the
server should be working on a response to send back. Just a thought. This
point might need some code examples to clarify. I'll try and make some code
available online later.

2. services. Like mentioned earlier webservices implemented in both xml-rpc
and soap. Define folder, it has a class of some sort with a lot of
rpc_<method-name> in it. I want to find some way of mapping those methods in
a generic XML-RCP and SOAP-resource so the server can respond to both type
of calls, but the definition/implementation of the method is stored in one
class, one time.

3. tasks. Once again, this will subclass one class and be in a seperate
folder, scanned at startup and run at times specified in the source-code of
the task, or better, in a config someplace.

[snip lots of cool-looking code I'll try as soon as this workday is over
:-) ]

Thanks alot for your help so far. I'll try and get some code online which
will make it easier to understand what I'm looking for.

Best regards,
Thomas





More information about the Twisted-Python mailing list