[Bese-devel] Re: Rendering a component to a string

Marco Baringer mb at bese.it
Fri Feb 24 19:21:27 UTC 2006


Aycan iRiCAN wrote:
> Hi,
> 
> Is it possible to render a form component to a string? I want to send
> the filled form via email to someone.

the render :wrapping method on standard-component bind yaclml-stream to
the response's html-stream.

try messing with html-stream before calling render, something like this:

(let ((old-stream (html-stream (context.request *context*))))
  (with-output-to-string (render-output)
    (setf (html-stream (context.request *context*)) render-output)
    (render FORM-COMPONENT)
    (setf (html-stream (context.request *context*)) old-stream)))

(totally untested)

the more i think about it the stupider it seems to rebind yaclml-stream
in each and every call to render, moving this someplace else (like the
"top-level" call to render) would be a bit cleaner and make what you're
trying to do trivial.

hth.
-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen




More information about the bese-devel mailing list