[Gd-chatter] r11710 - in trunk/libraries/network/koala/sources: examples/koala-basics koala

cgay at gwydiondylan.org cgay at gwydiondylan.org
Mon Feb 25 17:17:14 CET 2008


Author: cgay
Date: Mon Feb 25 17:17:13 2008
New Revision: 11710

Modified:
   trunk/libraries/network/koala/sources/examples/koala-basics/main.dylan
   trunk/libraries/network/koala/sources/koala/library.dylan
   trunk/libraries/network/koala/sources/koala/responders.dylan
   trunk/libraries/network/koala/sources/koala/server.dylan
Log:
job: koala
Unbreak more of koala-basics library.

Modified: trunk/libraries/network/koala/sources/examples/koala-basics/main.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/examples/koala-basics/main.dylan	(original)
+++ trunk/libraries/network/koala/sources/examples/koala-basics/main.dylan	Mon Feb 25 17:17:13 2008
@@ -250,7 +250,7 @@
     ()
   let response = current-response();
   let username
-    = get-form-value("username")
+    = get-query-value("username")
       | get-attribute(get-session(get-request(response)), #"username");
   username & write(output-stream(response), username);
 end;

Modified: trunk/libraries/network/koala/sources/koala/library.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/library.dylan	(original)
+++ trunk/libraries/network/koala/sources/koala/library.dylan	Mon Feb 25 17:17:13 2008
@@ -171,15 +171,10 @@
 
     // Form/query values.  (Is there a good name that covers both of these?)
     get-query-value,             // Get a query value that was passed in a URL or a form
-    get-form-value,              // A synonym for get-query-value
     do-query-values,             // Call f(key, val) for each query in the URL or form
-    do-form-values,              // A synonym for do-query-values
     count-query-values,
-    count-form-values,
     application-error,
     current-url,
-    decode-url,
-    encode-url,
     redirect-to;
 
   // Virtual hosts
@@ -274,8 +269,7 @@
     internal-server-error,
     bad-request,
     request-url,
-    request-tail-url,
-    register-auto-responder;
+    request-tail-url;
 
   // Debugging
   create

Modified: trunk/libraries/network/koala/sources/koala/responders.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/responders.dylan	(original)
+++ trunk/libraries/network/koala/sources/koala/responders.dylan	Mon Feb 25 17:17:13 2008
@@ -54,7 +54,7 @@
      #key replace?,
           request-methods = #(#"get", #"put"))
   let table = make(<table>, size: 1);
-  table[compile-regex("^$")] := response-function;
+  table[compile-regex("^$")] := list(response-function);
   add-responder(url, table,
                 replace?: replace?,
                 request-methods: request-methods)
@@ -67,11 +67,13 @@
     (url :: <url>, regex-map :: <table>,
      #key replace?,
           request-methods = #(#"get", #"put"))
-  for (response keyed-by regex in regex-map)
-    assert(instance?(response, <function>) & instance?(regex, <regex>),
+  for (responses keyed-by regex in regex-map)
+    assert(instance?(regex, <regex>)
+             & instance?(responses, <sequence>)
+             & every?(rcurry(instance?, <function>), responses),
            "The regex-map argument to add-responder must be a table "
-           "mapping <regex> to <function>.  Found %= -> %=.",
-           regex, response);
+           "mapping <regex> to a sequence of functions.  Found %= -> %=.",
+           regex, responses);
   end;
   let responder = make(<responder>);
   for (request-method in request-methods)
@@ -221,13 +223,14 @@
 // define responder test ("/test" /* , secure?: #t */ )
 //   format(output-stream(response), "<html><body>test</body></html>");
 // end;
+// This is just minimally working after the switch to "define url-map" 
 define macro responder-definer
   { define responder ?:name (?url:expression)
       ?:body
     end
   }
   => { define method ?name () ?body end;
-         add-responder(?url, ?name)
+       add-responder(?url, ?name)
      }
 end macro responder-definer;
 

Modified: trunk/libraries/network/koala/sources/koala/server.dylan
==============================================================================
--- trunk/libraries/network/koala/sources/koala/server.dylan	(original)
+++ trunk/libraries/network/koala/sources/koala/server.dylan	Mon Feb 25 17:17:13 2008
@@ -884,10 +884,9 @@
            end if;
          end for;
        end if;
-       do(method (action)
-            invoke-action(request, action, arguments);
-          end,
-          actions);
+       for (action in actions)
+         invoke-action(request, action, arguments)
+       end;
      else
        resource-not-found-error(url: url);
      end if;
@@ -1064,3 +1063,14 @@
   end
 end function get-query-value;
 
+define function count-query-values
+    () => (count :: <integer>)
+  *request*.request-query-values.size
+end;
+
+define method do-query-values
+    (f :: <function>)
+  for (val keyed-by key in *request*.request-query-values)
+    f(key, val);
+  end;
+end;



More information about the chatter mailing list