The information on this page is obsolete, incomplete or incorrect and left here only for reference and has not been ported to the new documentation wiki.
Please refer to the TurboGears documentation wiki for up-to-date documentation.
I started a proof of concept about another way to create and customize Widget. It's a work in progress, but feedback (goals/approach, style, tips,...) will be appreciated. The P.O.C include an API definition and implementation of part of it.
The result are Python packages (part are attached) and proposition about TG Widgets' futur (some proposition were based on idea found in mailing-list (Michele Cella,...)) :
- define the simplest api that allow integration of widget with TG :
- the name of the method/attribute to retreive css js for a widget
- Resource and children class (don't need to be full widget)
- the methode to call to register static directory
- the signature/API of the method to display a value (value could be a dict)
- the signature/API of the method to validate/update values and error
- instead of render, source, sample, register, define an entry_points (like for template engine) use by Toolbox.
The advantages are:
class WidgetFamilySamples(toolbox.controllers.Root): """ Global description of the widget family """ def list(): """return the list of samples'name (string)""" pass def display(sample_name): """return the sample (like a call to widget.insert(...) or widget.display(...) (in my widgetit)""" pass def description(sample_name): """return the description of the sample as string (ReST format ?)""" pass def categories(sample_name): """return the list of categories (string)""" pass #define exposed methods used to illustrate some special features (validation/AJAX,...) #...
- provide sample are optionnal for widget developer
- several samples could be provide to illustrate usage of a widget
- sample could illustrate usage of a group/assemblage of widget
- sample could use server-side features
- don't force the internal implementation of widgets (with attribute like template, or method like creat_dict())
- api.py (7.8 KB) - added by David Bernard <dwayne@…> 11 years ago.
- api.2.py (8.0 KB) - added by David Bernard <dwayne@…> 11 years ago.
- basicfield.py (10.4 KB) - added by David Bernard <dwayne@…> 11 years ago.
- decorator.py (4.0 KB) - added by David Bernard <dwayne@…> 11 years ago.
- deprecated.py (4.4 KB) - added by David Bernard <dwayne@…> 11 years ago.
- api.3.py (8.7 KB) - added by David Bernard <dwayne@…> 11 years ago.