Wednesday, February 28, 2007

PyCon: The Wonderful World of Widgets for the Web

This was a talk on Tosca Widgets by Kevin Dangoor, the leader of TurboGears. Overall, Kevin's a pretty charismatic guy, and the talk was well received.
  • These days, users require nicer, more featureful forms. Things like WYSIWYG widgets, date picker widgets, and autocompletion are becoming ubiquitous.
  • The goal of Tosca Widgets is to provide a way to encapsulate the HTML, CSS, and JavaScript necessary for things such as a WYSIWYG widget into a convenient package.
  • A Tosca Widget knows how to output HTML to link in the CSS and JavaScript.
  • Conceptually, this is part of the view layer (i.e. the V in MVC).
  • You are responsible for passing a value into the widget.
  • They are using FormEncode for validation.
  • The library knows how to aggregate individual widgets into a form.
  • Because the HTML, CSS, and JavaScript are packaged together, it's easy to add Ajax behavior to the widget.
  • However, they don't yet have built in JavaScript validation. JavaScript validation routines built on top of FormEncode would be a natural progression.
  • It's easy to package a widget into a Python egg. The widgets installed are discoverable because they provide a setuptools entry point.
  • Unlike Dojo widgets, the emphasis is on packaging things together from the server's point of view. (I'm a little unclear about the correct overlap between these two projects. I get the feeling that he was hand waving a bit. However, it's clear that packaging widgets into Python eggs is helpful.)
  • They're using a templating engine (Kid?) for the HTML, but they're thinking of getting rid of that, per Ben Bangert.
  • There is a Tosca Widgets browser that lets you play around with all of the widgets you have installed.

1 comment:

Karl said...

However, they don't yet have built in JavaScript validation. JavaScript validation routines built on top of FormEncode would be a natural progression.

That's the current plan. I've talked to Ian about this and he's said that he'll accept patches for this. One more thing on my todo list...

Unlike Dojo widgets, the emphasis is on packaging things together from the server's point of view. (I'm a little unclear about the correct overlap between these two projects. I get the feeling that he was hand waving a bit. However, it's clear that packaging widgets into Python eggs is helpful.)

Dojo widgets (and GWT/Pyjamas) provide similar goals but the emphasis is purely on building up things in the browser while ToscaWidgets builds things on the server and provides form processing and handling as well. You can package dojo widgets as ToscaWidgets if you so desire.

BTW, I find that yui and yui-ext widgets better fit my style than the dojo equivalents.

They're using a templating engine (Kid?) for the HTML, but they're thinking of getting rid of that, per Ben Bangert.

ToscaWidgets can use any Buffet interface templating language to define widgets. Ben is concerned about perf and has requested that they be strings. Not sure what will come of this.

There is a Tosca Widgets browser that lets you play around with all of the widgets you have installed.

It's rough right now. I'm hoping to get this done and a preliminary version out this weekend.