[Seaside] WAComponent and HTML Emails?
philippe.marschall at gmail.com
Sun Aug 12 10:35:10 UTC 2007
2007/8/10, Ramon Leon <ramon.leon at allresnet.com>:
> > 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
> actionUrl: WAUrl new;
> 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
Can you have a look at Seaside2.8a1-pmm.434. It introduces the
somewhat unfortunatetly named WAHtmlBuilder (I'm open for better
suggestions). This already helped to reduce duplication in tests and
could further reduce duplaction in Coment and RSRSS2.
htmlString would look somehting like this:
rootBlock: [ :root | self updateRoot: root ];
> SomePage>>renderContentOn: html
> html anchor
> callback:[self emailPage: self printString];
> text: 'email me this page'.
> SomePage>>emailMe: aPageHtml
> 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.
Wouldn't you want something more customed that includes the full stack
and not html?
> Ramon Leon
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
More information about the seaside