From a49fbee71fd4772abeadaf777c26f05397fd5a15 Mon Sep 17 00:00:00 2001 From: interp Date: Sat, 26 Oct 2002 15:40:26 +0000 Subject: [PATCH] Change argument order in EXTRACT-BINDINGS and EXTRACT-SINGLE-BINDING to fit the one of the equivalent PLT procedure. --- scheme/httpd/surflets/surflets.scm | 6 +++--- .../httpd/surflets/web-server/root/surflets/add.scm | 2 +- .../surflets/web-server/root/surflets/test.scm | 13 ++++++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/scheme/httpd/surflets/surflets.scm b/scheme/httpd/surflets/surflets.scm index 8c30fe5..bb4a702 100644 --- a/scheme/httpd/surflets/surflets.scm +++ b/scheme/httpd/surflets/surflets.scm @@ -102,15 +102,15 @@ (else (error "No Content-length specified for POST data.")))) -(define (extract-bindings bindings key) +(define (extract-bindings key bindings) (let ((key (if (symbol? key) (symbol->string key) key))) (map cdr (filter (lambda (binding) (equal? (car binding) key)) bindings)))) -(define (extract-single-binding bindings key) - (let ((key-bindings (extract-bindings bindings key))) +(define (extract-single-binding key bindings) + (let ((key-bindings (extract-bindings key bindings))) (if (= 1 (length key-bindings)) (car key-bindings) (error "extract-one-binding: more than one or zero bindings found" diff --git a/scheme/httpd/surflets/web-server/root/surflets/add.scm b/scheme/httpd/surflets/web-server/root/surflets/add.scm index bd58905..2bf82e1 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/add.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/add.scm @@ -28,7 +28,7 @@ (let* ((bindings (form-query (http-url:search (request:url result)))) (number (string->number - (extract-single-binding bindings "number")))) + (extract-single-binding "number" bindings)))) (if number number (get-number input-text "Please enter a valid number"))))) diff --git a/scheme/httpd/surflets/web-server/root/surflets/test.scm b/scheme/httpd/surflets/web-server/root/surflets/test.scm index d2b01e5..e3c8479 100644 --- a/scheme/httpd/surflets/web-server/root/surflets/test.scm +++ b/scheme/httpd/surflets/web-server/root/surflets/test.scm @@ -12,15 +12,26 @@ `(html (body (h1 "This is from servlet") (servlet-form ,new-url + POST ,select ,(make-submit-button)) (hr) (p (URL "/" "Return to main menu.")) )))))) + (send-html/suspend + (lambda (continue) + `(html (body (h1 "Result") + ,(format #f "~s" (get-bindings req)) (br) + (URL ,continue "show results again") + (hr) + (p (URL "test.scm" "Test again.") (br) + (URL "/" "Return to main menu.")))))) + (send-html/finish - `(html (body (h1 "Result") + `(html (body (h1 "Result 2") ,(format #f "~s" (get-bindings req)) (hr) (p (URL "test.scm" "Test again.") (br) (URL "/" "Return to main menu."))))))) + ))