[Twisted-Python] subclassing twisted.web?

Kendall Clark kendall at monkeyfist.com
Mon Feb 11 14:09:14 EST 2002


Hi,

I'm playing around with some REST ideas[1], and I want to use this
approach to build a web-forum-like[2] app for one of my busy content
sites. I want to use a standalone, Python-based http server for this
app, so I've been looking at the simple http servers in the Python
lib, Zope's Z3, Medusa, and twisted.web.

For various reasons[3], I'd like to try twisted.web first, but I have a
few qestions --

(1) Is there a 'servlet' or other programming model to use with
    twisted.web? If so, is there any example code? How can I get
    started?

    In other words, how are people building Web apps with twisted.web?

(2) I'm also playing around with the idea of 'ad hoc http servers',
    i.e., lightweight servers that do one thing and one thing well,
    which gets integrated into an existing site using something like
    Apache's mod_rewrite and mod_proxy.

    So if I wanted to build a specialized twisted.web that only did
    one thing, is there a class I can subclass or methods I can
    override? 

    In other words, I want to specialize the bit(s) of twisted.web
    which map REQUEST.URI to a local entity; and I want to do so for
    particular HTTP methods (specifically, GET, POST, DELETE) and
    return the appropriate non-implemented HTTP response for
    everything else (i.e., 404 for non-existent URIs and <whatever>
    for the other HTTP methods).

I looked at the twisted.web source briefly, but nothing leapt out at
me, alas.

Thanks,
Kendall Clark

Footnotes: 
[1]  http://internet.conveyor.com/RESTwiki/moin.cgi

[2]  Yes, I looked at twisted.forum long enough to know that I can't
     use it; this forum app has to be fairly specialized to fit into
     an existing site.

[3]  If for no other reason, Z3 doesn't seem to have been busted out
     of Zope yet (as has ZODB, yay!), and I don't have the time or
     energy to work on that just to use it cleanly. Plus, I'm looking
     for reasons to use twisted.





More information about the Twisted-Python mailing list