[Seaside] WAComponent and HTML Emails?
Ramon Leon
ramon.leon at allresnet.com
Fri Aug 10 18:22:31 UTC 2007
> I've rendered components to feed our PDF generator, sounds
> like it would be similar to just get the HTML back. You'll
> need to add a bit of context yourself, as this is ripped
> straight out of the system, see last line there in #renderPDF
> that would be the string you need.
>
>
> Hope this helps,
>
> -Boris
Yup, looks good (only works in 2.8), though I think this should be something
that's easy to get to. What about something like this added to WAComponent
to allow printString and asString on any WAComponent?
WARenderHandler>>context: aContext
context := aContext
WAComponent>>printOn: aStream
"setup a fake rendering context and response so I can render myself to a
stream for asString and printString"
| response handler |
handler := WARenderHandler root: self.
response := WAResponse new.
"had to create set accessor for context"
handler context: (WARenderingContext new session: WACurrentSession
value;
actionUrl: WAUrl new;
yourself).
handler processRendering: response.
aStream nextPutAll: response contents contents
Lukas, Phillip, any objection to me committing this? It would become really
easy to get the rendered html for any component, so you could do things like
this...
SomePage>>renderContentOn: html
html anchor
callback:[self emailPage: self printString];
text: 'email me this page'.
SomePage>>emailMe: aPageHtml
SeasidePlatformSupport
deliverMailFrom: 'ramon.leon at onsmalltalk.com'
to: #('ramon.leon at onsmalltalk.com' )
text: (String streamContents: [:stream |
stream nextPutAll: 'Subject: The Page You Requested';
cr; nextPutAll: 'Content-type:text/html';
cr; nextPutAll: aPageHtml])
The real reason I want it, is to do something like this...
[self someThingThatBlowsUp]
on:Error do:[:error |
self emailPage: (WAWalkback exception: error) displayString]
So I can get Seaside's nice walk back page emailed to me for unexpected
errors that happen in production.
Ramon Leon
http://onsmalltalk.com
More information about the seaside
mailing list