allow the client to figure out the auth for a local connection

This commit is contained in:
Damien Churchill 2009-03-03 19:05:23 +00:00
commit 80fdc3356c

View file

@ -145,26 +145,13 @@ class JSON(resource.Resource):
"web.connect": self.connect, "web.connect": self.connect,
"web.connected": self.connected "web.connected": self.connected
} }
for entry in open(common.get_default_config_dir("auth")):
parts = entry.split(":")
if len(parts) > 1:
username, password = parts[0], parts[1]
else:
continue
if username != "localclient": def _connect(self, host="localhost", port=58846, username="", password=""):
continue
self.local_username = username
self.local_password = password
def _connect(self, host="localhost", port=58846, username=None, password=None):
""" """
Connects the client to a daemon Connects the client to a daemon
""" """
username = username or self.local_username
password = password or self.local_password
d = Deferred() d = Deferred()
_d = client.connect(host=host, username=username, password=password) _d = client.connect(host, port, username, password)
def on_get_methods(methods): def on_get_methods(methods):
""" """
@ -556,7 +543,7 @@ class TopLevel(resource.Resource):
self.putChild("json", JSON()) self.putChild("json", JSON())
self.putChild("upload", Upload()) self.putChild("upload", Upload())
self.putChild("render", Render()) self.putChild("render", Render())
self.putChild("test", static.File("test.html")) self.putChild("test", static.File(rpath("test.html")))
self.putChild("themes", static.File(rpath("themes"))) self.putChild("themes", static.File(rpath("themes")))
self.putChild("tracker", Tracker()) self.putChild("tracker", Tracker())