Richard Newman | 4 Mar 2006 06:05
Picon
Picon

Re: POST variables in araneida

James,
   You might be interested in something like

   (flet
     ((write-body-bindings (binding-specifiers body)
        "Auxiliary function for with-request-params."
        (loop for (var param &optional type-fun) in binding-specifiers
              collecting
              (list var
                    (if type-fun
                      (list type-fun (list 'body-param param body))
                      (list 'body-param param body))))))

     (defmacro with-body-params (request binding-specifiers &body body)
       "Each binding specifier is a triple, (var param &optional type- 
fun).
        If TYPE-FUN is not provided, CAR is used to get rid of the  
wrapping
        list that URL-QUERY-PARAM returns."
       (let ((r-body (gensym)))
         `(let ((,r-body (request-body ,request)))
            (let (, <at> (write-body-bindings binding-specifiers r-body))
              , <at> body)))))

   which will save you typing out a load of calls to BODY-PARAM, if  
you're using form-encoded bodies.

   I'm sure Alan has something a lot more integrated!

   Take a look in (IIRC) daemon.lisp to see how bodies are handled.  
(Continue reading)

James Fleming | 4 Mar 2006 09:05

Re: POST variables in araneida

> James,
>   You might be interested in something like
<snip>
>   which will save you typing out a load of calls to BODY-PARAM, if  
> you're using form-encoded bodies.

Thankye kindly. I'm still slowly coming to grips with lisp, so this will
take a little while to digest. Looks rather useful, though.

>   Take a look in (IIRC) daemon.lisp to see how bodies are handled.  
I shall; thanks for the pointer.

> We had some discussion of this many moons ago.
Oops; my bad for forgetting to trawl the archives.

Thanks,
James

> -R
> 
> On 3 Mar 2006, at 20:00, James Fleming wrote:
> 
> >>Stupid question time: when using POST to submit a form, how do I
> >>retrieve the data sent by the browser?
> >
> >Embarrassing answer time: the clue I needed was on the Cliki page.
> >(request-body request) gives me what I need.
> >
> >In penance, I shall write a HOWTO for araneida, once I've gotten the
> >whole thing running.
(Continue reading)


Gmane