5 Feb 18:53
Re: Koala update
From: Hannes Mehnert <hannes <at> mehnert.org>
Subject: Re: Koala update
Newsgroups: gmane.comp.lang.dylan.gwydion.devel
Date: 2008-02-05 17:53:24 GMT
Subject: Re: Koala update
Newsgroups: gmane.comp.lang.dylan.gwydion.devel
Date: 2008-02-05 17:53:24 GMT
Hi, Bastian M?üller wrote: >> (4) Create some macros that keep the URL <=> responder mappings >> at a central place. > > New proposal: > > define responders > "/foo/" > (argument-regex1) => foo-argument-responder1, > (argument-regex1) => begin > foo-argument-method1; > foo-argument-method2; > end; > "/baz" () => baz-responder; // without argument-regex > "/blub" => blub-responder; // normal page-responder > ... > > As there are still no comments, I'd like to encourge anyone who's > working on/with koala to to post his wishes and thoughts. I like the system Allegro Webactions [http://opensource.franz.com/aserve/aserve-dist/webactions/doc/webactions.html] has: (("main" "main.clp") ("signin" action-sign-in) ("choice" action-check-login "choice.clp") ("vote" action-check-login action-vote) ("thanks" action-check-login "thanks.clp"))) The left hand side are URLs, the right hand side are the actions. There are two different actions available: a function call (like action-check-login) or a website ("thanks.clp", for dynamic content, like dsp). Actions are executed sequentially, stopping if an action returned false. It is quite common that some parts are only accessible after a successful authentication, that's why I would like to have the possibility to express this directly in the map. So, my current proposal for the macro would be: define url-map "/foo" ("\w/\w/\w") => bind-arguments; "foo.dsp", ("") => "foo.dsp"; "/bar" ("\d/\d/\w") => authenticated-user?; bind-arguments; "bar.dsp"; "/foobar" () => admin-user?; foobar-responder; "/barfoo" () => "barfoo.dsp"; end; Which is quite similar, the major difference is what is written on the right hand side of an URL. I'd be happy if there is support for functions (which are called with apply (function, args-from-regex)) as well as dsp files (by writing a string (or symbol?)). I also really like to have the authentication-checks at one central place, so it's easy to see who is supposed to have access to which pages. Happy hacking, Hannes
RSS Feed