[Seaside] #WAAbstractHtmlBuilder #list:do: Bug

Damien Cassou damien.cassou at laposte.net
Wed Jul 19 15:31:19 UTC 2006


Chiara wrote:
> Hi, I'm new in seaside,

Hi Chiara,

welcome


> I try to use the #list:do method but I figure
> out that it has a bug.


I don't think so, but I might be wrong.


> The original code is:
> 
> #WAAbstractHtmlBuilder>>list: aCollection do: aBlock
>     self unorderedList:
>         [aCollection do:
>             [:item |
>             self listItem: [aBlock value: item]]]
> 
> I know that #listItem: expect a String 


How do you know this ? I think listItem: expects a block.


> but in the previos code, it is
> receiving a Block (self listItem: [aBlock value: item]).
> I change this method with:
> 
> #WAAbstractHtmlBuilder>>list: aCollection do: aBlock
>     self unorderedList:
>         [aCollection do:
>             [:item |
>             self listItem: (aBlock value: item)]]
> 
> and seems to work ok.



You have broke a lot of code :-)


> It is that ok? or I  just misunderstood the method? I realize of this
> when a use it in:
> 
> html list: self persons do:[:person | person name].


I think this code is wrong, you should have wrote:

html list: self persons do: [:person | html text: person name]

This is because #list:do: expects a block that will render something.
You could use also:

html list: (self persons collect: [:person | person name]). If you have 
a look at how #list is implemented, you will see that it sends #text: 
for each element.


Did you heard about the new Canvas API ? If you are new in Seaside, you 
might to try it because it is the future. Just ask if you want to know 
more about this.


Hope I'm not wrong

Bye


More information about the Seaside mailing list