[Twisted-Python] [patch] mktap web --resource
Sune Kirkeby
sune at mel.interspace.dk
Wed Jan 2 09:55:54 MST 2002
[ Sune Kirkeby ]
> Attached is a short patch
and-here-it-really-is'ly
--
Sune Kirkeby | STUPIDITY -- Quitters Never Win, Winners Never Quit,
| But Those Who Never Win AND Never Quit Are Idiots.
-------------- next part --------------
diff --exclude-from=diffignore -Naur Twisted-0.12.3/twisted/tap/web.py Twisted/twisted/tap/web.py
--- Twisted-0.12.3/twisted/tap/web.py Wed Nov 28 08:17:29 2001
+++ Twisted/twisted/tap/web.py Wed Jan 2 17:31:02 2002
@@ -73,6 +73,18 @@
opt_s = opt_static
+ def opt_resource(self, path):
+ """<class> is the name (including module) of a subclass of
+ twisted.web.resource.Resource to publish."""
+
+ i = string.rindex(path, '.')
+ module_name, klass_name = path[:i], path[i+1:]
+
+ module = __import__(module_name)
+ klass = getattr(module, klass_name)
+ self.root = klass()
+
+ opt_r = opt_resource
def getPorts(app, config):
ports = []
More information about the Twisted-Python
mailing list