From 78dfc57b1e78a3e7975b0cf4153ca8d230004132 Mon Sep 17 00:00:00 2001 From: David Adam Date: Fri, 30 Jan 2015 22:54:11 +0800 Subject: web_config: set new prompts via JSON instead of URI-encoded Fixes problems with encoding and decoding Unicode from URL-encoded strings, which was impossible to get right in Python 2. --- share/tools/web_config/js/controllers.js | 2 +- share/tools/web_config/webconfig.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'share/tools') diff --git a/share/tools/web_config/js/controllers.js b/share/tools/web_config/js/controllers.js index 5f4135c1..0ddfa83f 100644 --- a/share/tools/web_config/js/controllers.js +++ b/share/tools/web_config/js/controllers.js @@ -140,7 +140,7 @@ controllers.controller("promptController", function($scope, $http) { } $scope.setNewPrompt = function(selectedPrompt) { - $http.post("set_prompt/","what=" + encodeURIComponent(selectedPrompt.function), { headers: {'Content-Type': 'application/x-www-form-urlencoded'} }).success(function(data, status, headers, config){ + $http.post("set_prompt/", {'fish_prompt': selectedPrompt.function,}).success(function(data, status, headers, config){ // Update attributes of current prompt and select it $scope.samplePrompts[0].demo = selectedPrompt.demo; diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index 6b1d524f..8f591d17 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -816,8 +816,8 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): else: output = ["Unable to delete history item"] elif p == '/set_prompt/': - what = postvars.get('what') - if self.do_set_prompt_function(what[0]): + what = postvars.get('fish_prompt') + if self.do_set_prompt_function(what): output = ["OK"] else: output = ["Unable to set prompt"] -- cgit v1.2.3