aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/tools
diff options
context:
space:
mode:
authorGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2015-01-30 22:54:11 +0800
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2015-01-30 22:54:13 +0800
commit78dfc57b1e78a3e7975b0cf4153ca8d230004132 (patch)
treeb1ce72df37216686c033a080b5e35d1ca74c5d86 /share/tools
parentd17ba69f9ec65d6f4c5898abc7195c85422e7da9 (diff)
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.
Diffstat (limited to 'share/tools')
-rw-r--r--share/tools/web_config/js/controllers.js2
-rwxr-xr-xshare/tools/web_config/webconfig.py4
2 files changed, 3 insertions, 3 deletions
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"]