On Aug 18, 2006, at 1:48 PM, BJörn Lindqvist wrote:

>
>> Unless I'm very, very mistaken, with widgets, you can pass in any
>> parameters you want, do things with those values, then render them as
>> html.  What more could you want?
>>
>> I can't think of anything of the top of my head that you couldn't do
>> with a widget if you pass in the right parameters.
>
> I want to generate HTML output like this:

Let's get one thing clear please: Widget's are NOT (only) HTML markup  
generators. They do generate markup but their main reason to-be (IMO)  
is to nicely pack and reuse common view elements and their resources  
(AutoCompleteField, CalendarDatePicker, TinyMCE, etc...) and to  
validate and coerce into python objects the input received from the web.

> <p>item1<br/>
> item2<br/>
> ...
> itemX</p>
>
> item1..itemX are either plain text strings or they are contained
> widgets. It is trivial to manually generate text like this, but I want
> to do it the idiomatic, widgets-way. My requirement for the solution
> is that it must not be much more complex than this:
>
> def list_items_to_html(items):
>     return "<p>" + "<br/>".join(render(item) for item in items) +  
> "</p>"

This seems like a task best suited for proper (X)HTML generators like  
elementtree, markup, stan, kid etc... IMO. Using widgets to do this  
would probably be overkill (unless each <p> needs some special  
javascript source files included, for example)

Alberto
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to