Chapter 16.1. Understanding Widgets

CherryPy, Kid, SQLObject, and MochiKit bring a lot to the table. TurboGears Widgets add another element which helps to complete the package. Other frameworks provide you mechanisms for reusing dynamic HTML snippets, and a couple even let you reuse chunks of JavaScript in your pages. But the turbogears.widgets package goes beyond all of that to make it easy to just call a widget in your template and have the HTML, CSS, and Javascript automatically added to your page—in the right places. But that’s not all, widgets also help you to encode form results back into the right kind of Python objects, and handle any validation errors!

Widgets can be as simple as an HTML form element like the TextField or a MultipleSelect ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.