[Seaside] Brushes and state

Colin Putney cputney at wiresong.ca
Sat Jun 20 22:22:58 UTC 2009

On 19-Jun-09, at 12:20 PM, Julian Fitzell wrote:

> The idea of having different Renderers is that, for example,  
> somebody might eventually decide they'd really like to have  
> templates in Seaside and that would probably be implemented as a  
> different Renderer. Or maybe they want to embed a google map in a  
> Component that is using the RSS Renderer (actually, that Renderer  
> still uses Brushes, so it may not be the best example). As I said,  
> this is relatively theoretical at the moment given the lack of other  
> Renderers but I'm interested in it from the architectural angle.

Well, too theoretical. I'm working integrating my Altitude experiment  
back into Seaside 2.9. It makes changes to the rendering of links and  
forms, so I'm using an alternate Renderer to allow it to exist side-by- 
side with the normal behavior. Creating alternate renderers isn't a  
very common need, but it's really handy when you need to do something  
out of the ordinary. Without adding special support, I wouldn't be  
able to use James maps implementation with Atitude.

> I believe (and this is where I may be wrong) that an implementation  
> using Brushes is (slightly) less flexible and, while there are  
> things that would be easier using Brushes, I don't see that this  
> problem does any of those things.

I think the problem here is that it violates the intent of the design.

WAHtmlCanvas provides an abstraction for generating HTML. It does  
provide a very few higher level abstractions, such as callbacks, but  
generally it operates at the level of tags and attributes. Rendering a  
higher-level abstraction in terms of HTML tags is not the roll of a  
brush, it's the roll of a component. Now, if you don't need to retain  
state between HTTP requests, you don't need a full component; a simple  
painter will do.

I think implementing a new kind of brush should be a fairly rare  
thing, and reserved for those occasions where you need to generate  
markup that the regular WAHtmlCanvas can't produce.


More information about the seaside mailing list