allow webfront to use a strports port specification

This commit is contained in:
Brian Warner 2006-12-07 12:47:40 -07:00
parent 36e340b9e0
commit 2a5e4f3ef6
2 changed files with 5 additions and 4 deletions

View File

@ -37,7 +37,7 @@ class Client(node.Node, Referenceable):
WEBPORTFILE = os.path.join(self.basedir, self.WEBPORTFILE)
if os.path.exists(WEBPORTFILE):
f = open(WEBPORTFILE, "r")
webport = int(f.read())
webport = f.read() # strports string
f.close()
self.add_service(WebishServer(webport))
self.queen_pburl = None

View File

@ -1,5 +1,5 @@
from twisted.application import service, internet
from twisted.application import service, strports
from twisted.web import static, resource, server
from twisted.python import util, log
from nevow import inevow, rend, loaders, appserver, url, tags as T
@ -18,7 +18,6 @@ class IClient(Interface):
class WebishServer(service.MultiService):
name = "webish"
WEBPORTFILE = "webport"
def __init__(self, webport):
service.MultiService.__init__(self)
@ -28,7 +27,9 @@ class WebishServer(service.MultiService):
root.putChild("vdrive",
static.Data("sorry, still initializing", "text/plain"))
self.site = site = appserver.NevowSite(root)
internet.TCPServer(webport, site).setServiceParent(self)
s = strports.service(webport, site)
s.setServiceParent(self)
self.listener = s # stash it so the tests can query for the portnum
def startService(self):
service.MultiService.startService(self)