Coverage for tw2.core.params : 94%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"Errors related to parameters."
"""This class is used to mark a widget parameter as being required, by setting the default value to this.""" return 'Required'
""" Used to explicitly mark a parameter as being automatically generated. """ return 'Auto'
"""This class is used as a wrapper around a parameter value. It takes a callable, which will be called every time the widget is displayed, with the returned value giving the parameter value."""
doc = self.fn.__doc__ if self.fn.__doc__ else '<Deferred>' return '<Deferred: %s>' % doc
return 'Default'
"""A parameter for a widget.
`description` A string to describe the parameter. When overriding a parameter description, the string can include ``$$`` to insert the previous description.
`default` The default value for the parameter. If no defalt is specified, the parameter is a required parameter. This can also be specified explicitly using tw.Required.
`request_local` Can the parameter be overriden on a per-request basis? (default: True)
`attribute` Should the parameter be automatically included as an attribute? (default: False)
`view_name` The name used for the attribute. This is useful for attributes like *class* which are reserved names in Python. If this is None, the name is used. (default: None)
The class takes care to record which arguments have been explictly specifed, even if to their default value. If a parameter from a base class is updated in a subclass, arguments that have been explicitly specified will override the base class. """
request_local=Default, attribute=Default, view_name=Default):
'description', 'default', 'request_local', 'attribute', 'view_name', ]
return '%s: %s (default: %s, defined on: %s)' % ( self.name, self.description, self.default, self.defined_on)
"""A variable - a parameter that is passed from the widget to the template, but cannot be controlled by the user. These do not appear in the concise documentation for the widget. """
"""A parameter that applies to children of this widget
This is useful for situations such as a layout widget, which adds a :attr:`label` parameter to each of its children. When a Widget subclass is defined with a parent, the widget picks up the defaults for any child parameters from the parent. """
"""A variable that applies to children of this widget """
"Meta class the collects parameters."
"""Create a new `Widget` subclass. This detects `Param` instances defined declaratively, updates with information from the containing class, and stores the objects in `_params`."""
else:
else:
if not p.child_param)
|