Hey guys,

So, we've been talking about ToscaWidgets 2.0 for a while.  I decided
to push out a release because I have been using it in a production-
level system I am building, and have quite a few of the kinks worked
out.  There are still more, but this is the kind of project you could
get started with now if you have something new you are starting with
and expect to use for a while.  There is really just form support
right now, but we shall be adding wrappers for the most popular JS
libraries as we find a need for them.  Anyone who wouldl like to help
in this effort is encouraged to do so.

So, what _is_ tw2?  Basically, tw2 is a widgeting library with a
similar API to tw 0.9.x, but there are some small changes in the api,
and overall design.

Design changes
-------------------------

Per Request Widgets:
Widgets are now per-request, this means that you can assign attributes
to them after creation, something before unheard of in tw.  This also
means that you must call display() because the way a widget handles
per-request is by making a copy of itself for each request.  Now, I
know this sounds slow, but keep in mine that negating the need for all
of the request-local determination.  2.0 is in fact 2x as fast as
0.9.8.

Prepare vs update_params:
There are a few other small changes, including using prepare() instead
up update_params(), but now you can assign values to the widget (or
child widgets) within prepare().  This actually makes thing a lot
easier.  In fact, the parameter system is re-worked in 2.0 to handle
the differences between those attributes that you want to expose to
the template and those you do not.  However, the original params api
from 0.9.8 still works.

Widget-level Controllers:
Each widget has a request() function that allows you to tie server
side code in.  This is a great way to take advantage of subclassing
with widgets, without having to cut/paste/subclass controller classes
that work with the widgets.  The widgets take the controller specs
with them.  This is the most likely code to change from alpha to beta
release, as I am coming up with a Turbogears-like scheme to add some
Object Dispatch to the widgets response handler.

Template Selection:
You no longer have to specify which kind of template you want to use.
Simply put the dotted template name in the name of the widget, and TW
will detect which template engines you have defined for your widget.
The middleware sets up a list of default template engines to look for
a template for, so you can specify if you prefer genshi over mako, for
instance.  The order of preference for template engines is: [mako,
genshi, kid, cheetah]

I guess that's the brunt of the changes.  The api is really similar,
the codebase is clean and well tested.  Even in alpha we are at over
95% code coverage for tw2.core and tw2.forms.  Here's more
documentation:
http://toscawidgets.org/documentation/tw2.core/

So, feel free to play around with the new codebase, and keep in mind
it is alpha-level code when you find some rough edges.

http://pypi.python.org/pypi/tw2.core/2.0a1
http://pypi.python.org/pypi/tw2.forms/2.0a1

cheers.
-chris

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to