[Gd-hackers] Koala update

Bastian M?üller turbo24prg at web.de
Tue Feb 5 12:54:29 CET 2008


Bastian Mueller wrote:

Hej,

> (1) Replace the simple URI handling with a mostly RFC 3986
>      compliant URI library soon to be put into /libraries/.
>      Currently, koala percent-decodes the whole URL, ie.
>      destroys it.
That's almost finished, adding and finding responders works again.

> 
> (4) Create some macros that keep the URL <=> responder mappings
>      at a central place. hannes suggested something like
>      (including my ideas):
> 
>    define responders
>      "/foo/" (regex)      // with argument-regex (see below)
>      begin
>        method1;           // several methods
>        method2;
>        method3
>      end,
>     "/bar/" (regex)
>        method4,
>     "/baz/" ()            // without argument-regex
>        method5,
>     "/blub",              // normal page-responder
>        method6,
>      ...
> 
I thought about that after looking over the django examples again:

     (r'^polls/(?P<poll_id>\d+)/$', 'mysite.polls.views.detail'),
     (r'^polls/(?P<poll_id>\d+)/results/$', 'mysite.polls.views.results'),
     (r'^polls/(?P<poll_id>\d+)/vote/$', 'mysite.polls.views.vote'),

That's not possible with the macro above. It should be possible to
have one static prefix and a mapping of argument-regex => responder.

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.

kind regards,
   Bastian




More information about the hackers mailing list