fix returning the call when the method doesn't return a deferred

This commit is contained in:
Damien Churchill 2009-08-20 00:27:34 +00:00
parent ea3f8b7d34
commit 7d0ccb8847
1 changed files with 16 additions and 2 deletions

View File

@ -233,6 +233,7 @@ class JSON(resource.Resource, component.Component):
d.addErrback(self._on_rpc_request_failed, response, request) d.addErrback(self._on_rpc_request_failed, response, request)
return d return d
else: else:
response["result"] = d
return self._send_response(request, response) return self._send_response(request, response)
def _on_json_request_failed(self, reason, request): def _on_json_request_failed(self, reason, request):
@ -702,10 +703,23 @@ class WebApi(JSONComponent):
:rtype: dictionary :rtype: dictionary
:returns: the configuration :returns: the configuration
""" """
config = component.get("DelugeWeb").config.config.copy() config = component.get("DelugeWeb").config.config.copy()
del config["sessions"] del config["sessions"]
del config["pwd_salt"] del config["pwd_salt"]
del config["pwd_sha1"] del config["pwd_sha1"]
return config return config
@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]