From 7d0ccb8847acf8e755274eed3d290b78e35956de Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Thu, 20 Aug 2009 00:27:34 +0000 Subject: [PATCH] fix returning the call when the method doesn't return a deferred --- deluge/ui/web/json_api.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py index 6245ab9d8..3bb2d277b 100644 --- a/deluge/ui/web/json_api.py +++ b/deluge/ui/web/json_api.py @@ -233,6 +233,7 @@ class JSON(resource.Resource, component.Component): d.addErrback(self._on_rpc_request_failed, response, request) return d else: + response["result"] = d return self._send_response(request, response) def _on_json_request_failed(self, reason, request): @@ -702,10 +703,23 @@ class WebApi(JSONComponent): :rtype: dictionary :returns: the configuration """ - config = component.get("DelugeWeb").config.config.copy() del config["sessions"] del config["pwd_salt"] del config["pwd_sha1"] return config - \ No newline at end of file + + + @export + def set_config(self, config): + """ + Sets the configuration dictionary for the web interface. + + :param config: The configuration options to update + :type config: dictionary + """ + web_config = component.get("DelugeWeb").config + for key in config.keys(): + if isinstance(config[key], unicode) or isinstance(config[key], str): + config[key] = config[key].encode("utf8") + web_config[key] = config[key] \ No newline at end of file