[Twisted-Python] serving up a directory
Clark C. Evans
cce at clarkevans.com
Sat Feb 22 21:57:38 MST 2003
On Sun, Feb 23, 2003 at 03:57:15AM +0000, Clark C. Evans wrote:
| root = Resource()
| root.putChild("dynamic",MyDynamicRequest())
| root.putChild("static",StaticRequest("/var/htdocs"))
Err, I just needed...
class StaticRequest(static.File): pass
Quite clean, and works exactly as I expected. Kudos.
I wouldn't have asked the question if the comment of
this class didn't use "file" in the singular in the
docstring. It could say:
This request handler serves up a path, including
the Directory and Files found recursively under it.
I'd also re-name the class "static.Path" as it really
isn't _just_ a file resource -- it serves up directories
too.
Thanks tons.
Clark
P.S. Is there a clear example (not using taps) of having
both an SMTP and a HTTP server in one process? Thanks!
More information about the Twisted-Python
mailing list