Why not ditch away all the templating functionality out of tw2 and
standardize on a a good 'ol (unicode please) string as output? This
would remove a lot of code and complexity and offer the best
flexibility: Use whatever method you want to build a damn string. :)
The only downside I can think of is that Genshi widgets will *crawl*
(due to all the de/serializing going on when rendering nested widgets)
but it shouldn't be a problem in practice to avoid genshi since I've
never found that it's full power (xincludes, py:match, etc...) is
needed to output a small chunk of markup, only when building a "full"
page that you want to easily extend. If this is ever a problem one
could always use chameleon.genshi for speed.
Alberto
To me there are a few more advantages to genshi: they are XML-based, and thus
prevent me from writing malformed templates. They also allow to have a
rendering-option that lets you put out various kinds of HTML-dialects with
just one source template. And last but not least they allow for easy
template-i18n, because they can use filters on their streams.
All this would be lost on a pure-string solution.
Diez
I fully agree with Diez on that. I really liked the possibility to
choose the HTML/XHMTL dialect with one config setting in TG1/Kid. With
Genshi, this became already more difficult and has several glitches
(http://trac.turbogears.org/ticket/2287). I'd rather see these issues
(e.g. http://toscawidgets.org/trac/tw/ticket/40) fixed instead of
getting things even worse in this respect.
-- Christoph
> Can you compare tw2 to django newforms?
Definitely, they're aiming at a similar space. I first looked at
newforms back in March, before I started tw2.exp. At that time it seemed
very much focused on the simpler widgets, basically forms, not the
fancier widgets like dynforms, dojo, yui, etc. I see they've now
introduced a concept like resources, or maybe I missed this first time
round. We should definitely keep an eye on newforms and keep in touch
with the Django guys. What would be great is if we found someone to be
the "Django man" for tw2.
> Which is the audience of tw2?
Now - users of tw1. Later - anyone developing an interactive web app in
Python.
> Honestly, I found the strength of tw to lie in environments like
> RUM or sprox, as it encapsulates everything.
Having something like rum/sprox is definitely important. I have a
feeling we should aim fo a single dbwidgets library, and this is
something we should start discussing soon. I'm still focused on other
things for now, but if you or Chris would like to kick off by doing a
port of sprox/rum, or just discussing ideas on the list, that'd be great.
Paul
def display(...):
.....
return u"<div ...>....</div>"
or:
def display(...):
....
return render_with_mako('some_template.mako', ....)
or .... any method you want to create an unicode string.
Alberto
I reckon we stick with what we've got, give or take minor tweaks for
performance.
Paul