fix some indentation issues

This commit is contained in:
Damien Churchill 2009-06-27 11:36:34 +00:00
commit cdf2f79c66

View file

@ -272,7 +272,7 @@ DEFAULT_PORT = 58846
DEFAULT_HOSTS = {
"hosts": [(hashlib.sha1(str(time.time())).hexdigest(),
DEFAULT_HOST, DEFAULT_PORT, "", "")]
DEFAULT_HOST, DEFAULT_PORT, "", "")]
}
HOSTLIST_ID = 0
HOSTLIST_NAME = 1
@ -364,7 +364,7 @@ class WebApi(JSONComponent):
d = Deferred()
log.info("Updating ui with keys '%r' and filters '%r'", keys,
filter_dict)
filter_dict)
def got_stats(stats):
ui_info["stats"] = stats
@ -388,7 +388,7 @@ class WebApi(JSONComponent):
d3.addCallback(got_stats)
dl = DeferredList([d1, d2, d3], consumeErrors=True)
dl.addCallback(on_complete)
dl.addCallback(on_complete)
return d
def _on_got_files(self, torrent, d):
@ -410,7 +410,7 @@ class WebApi(JSONComponent):
if type(item) is dict:
return item
return [info[path]["index"], info[path]["size"],
info[path]["progress"], info[path]["priority"]]
info[path]["progress"], info[path]["priority"]]
file_tree = uicommon.FileTree(paths)
file_tree.walk(walk)
@ -488,7 +488,7 @@ class WebApi(JSONComponent):
filename = os.path.basename(torrent["path"])
fdump = base64.encodestring(open(torrent["path"], "rb").read())
log.info("Adding torrent from file `%s` with options `%r`",
filename, torrent["options"])
filename, torrent["options"])
client.core.add_torrent_file(filename, fdump, torrent["options"])
d = Deferred()
d.callback(True)
@ -500,23 +500,23 @@ class WebApi(JSONComponent):
Return the hosts in the hostlist.
"""
log.debug("get_hosts called")
d = Deferred()
d.callback([(tuple(host[HOSTS_ID:HOSTS_PORT+1]) + (_("Offline"),)) for host in self.host_list["hosts"]])
return d
d = Deferred()
d.callback([(tuple(host[HOSTS_ID:HOSTS_PORT+1]) + (_("Offline"),)) for host in self.host_list["hosts"]])
return d
@export
def get_host_status(self, host_id):
"""
"""
Returns the current status for the specified host.
"""
main_deferred = Deferred()
main_deferred = Deferred()
(host_id, host, port, user, password) = self.get_host(host_id)
(host_id, host, port, user, password) = self.get_host(host_id)
def callback(status, info=None):
main_deferred.callback((host_id, host, port, status, info))
def callback(status, info=None):
main_deferred.callback((host_id, host, port, status, info))
def on_connect(connected, c, host_id):
def on_connect(connected, c, host_id):
def on_info(info, c):
c.disconnect()
callback(_("Online"), info)
@ -536,8 +536,8 @@ class WebApi(JSONComponent):
callback(_("Offline"))
if client.connected() and (host, port, "localclient" if not \
user and host in ("127.0.0.1", "localhost") else \
user) == client.connection_info():
user and host in ("127.0.0.1", "localhost") else \
user) == client.connection_info():
def on_info(info):
callback(_("Connected"), info)
@ -610,7 +610,7 @@ class WebApi(JSONComponent):
# Host isn't in the list, so lets add it
connection_id = hashlib.sha1(str(time.time())).hexdigest()
self.host_list["hosts"].append([connection_id, host, port, username,
password])
password])
self.host_list.save()
d.callback((True,))
return d