Modules
- tw2.bootstrap
- tw2.bootstrap.forms
- tw2.captcha
- tw2.core
- tw2.d3
- tw2.dynforms
- tw2.dyntext
- tw2.etc
- tw2.excanvas
- tw2.forms
- tw2.jit
- tw2.jqplugins.chosen
- tw2.jqplugins.cookies
- tw2.jqplugins.dynatree
- tw2.jqplugins.fg
- tw2.jqplugins.flot
- tw2.jqplugins.fullcalendar
- tw2.jqplugins.jqgrid
- tw2.jqplugins.jqplot
- tw2.jqplugins.portlets
- tw2.jqplugins.select2
- tw2.jqplugins.ui
- tw2.jquery
- tw2.lesscss
- tw2.polymaps
- tw2.protovis.conventional
- tw2.protovis.core
- tw2.protovis.custom
- tw2.protovis.hierarchies
- tw2.qrcode
- tw2.rrd
- tw2.slideymenu
- tw2.sqla
- tw2.tinymce
- tw2.tipster
- tw2.util.html5shim
- tw2.wysihtml5
tw2.core
tw2.core contains the base Widgets from which all others are derived.
A widget that has an arbitrary number of children, this is common for layout components, such as :class:`tw2.forms.TableLayout`.
A widget that has a single child, which is repeated an arbitrary number of times, such as :class:`tw2.forms.GridLayout`.
- repetitions
- Fixed number of repetitions. If this is None, it dynamically determined, based on the length of the value list.
- min_reps
- Minimum number of repetitions
- max_reps
- Maximum number of repetitions
- extra_reps
- Number of extra repeitions, beyond the length of the value list.
- children
- Children specified for this widget will be passed to the child. In the template, children gets the list of repeated childen.
A widget that has a single child. The parent widget is only used for display purposes; it does not affect value propagation or validation. This is used by widgets like :class:`tw2.forms.FieldSet`.
- children
- Children specified for this widget will be passed to the child
An HTML page. This widget includes a :meth:`request` method that serves the page.
- children
- Children specified for this widget will be passed to the child
- id_suffix
- Suffix to append to compound IDs
- content_type
- Content type header
- location
- Location on the page where the resource should be placed.This can be one of: head, headbottom, bodytop or bodybottom. None means the resource will not be injected, which is still useful, e.g. static images.
- modname
- Name of Python module that contains the file.
- filename
- Path to file, relative to module base.
- no_inject
- Don't inject this link. (Default: False)
- whole_dir
- Make the whole directory available. (Default: False)
- location
- Location on the page where the resource should be placed.This can be one of: head, headbottom, bodytop or bodybottom. None means the resource will not be injected, which is still useful, e.g. static images.
- modname
- Name of Python module that contains the file.
- no_inject
- Don't inject this link. (Default: False)
- whole_dir
- Make the whole directory available. (Default: False)
- location
- Location on the page where the resource should be placed.This can be one of: head, headbottom, bodytop or bodybottom. None means the resource will not be injected, which is still useful, e.g. static images.
- modname
- Name of Python module that contains the file.
- filename
- Path to file, relative to module base.
- no_inject
- Don't inject this link. (Default: False)
- whole_dir
- Make the whole directory available. (Default: False)
- location
- Location on the page where the resource should be placed.This can be one of: head, headbottom, bodytop or bodybottom. None means the resource will not be injected, which is still useful, e.g. static images.
- modname
- Name of Python module that contains the file.
- filename
- Path to file, relative to module base.
- no_inject
- Don't inject this link. (Default: False)
- whole_dir
- Make the whole directory available. (Default: False)
- media
- Media tag
- location
- Location on the page where the resource should be placed.This can be one of: head, headbottom, bodytop or bodybottom. None means the resource will not be injected, which is still useful, e.g. static images.
- src
- Source code
- location
- Location on the page where the resource should be placed.This can be one of: head, headbottom, bodytop or bodybottom. None means the resource will not be injected, which is still useful, e.g. static images.
- src
- CSS code
- A widget mixin that provides more advanced controller routing and
dispatching.
The need for this mainly sprung from a divergence of source trees (unintentionally forking) between the developers of tw2 while it was still alpha/beta. One team expected users to define controllers as a 'request' classmethod on the widget and another team expected users to define a Controller class as a child of the widget. Team A's pattern is now the default in the main tree. This is a shim to support Team B's approach.
Use it like this:
>>> import tw2.core >>> class MyWidget(tw2.core.TGStyleController, tw2.core.Widget): ... class Controller(object): ... @jsonify ... def some_method(self, req): ... return dict(foo="bar")