Package s3 :: Module s3xforms :: Class S3XFormsWidget
[frames] | no frames]

Class S3XFormsWidget

source code

object --+
         |
        S3XFormsWidget

XForms Form Widget (Base Class)

Instance Methods
 
__init__(self, translate=True)
Constructor
source code
 
__call__(self, field, label, ref)
Form builder entry point
source code
 
widget(self, field, attr)
Render the XForms Widget.
source code
 
hint(self)
Render the hint for this formfield
source code
 
label(self)
Render the label for this formfield
source code
 
setstr(self, key, string=None)
Add a translatable string to this widget
source code
 
getstr(self, tag, key, default=None)
Get a translated string reference
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, translate=True)
(Constructor)

source code 

Constructor

Parameters:
  • translate - enable/disable label translation
Overrides: object.__init__

__call__(self, field, label, ref)
(Call operator)

source code 

Form builder entry point

Parameters:
  • field - the Field or a Storage with field information
  • label - the label
  • ref - the reference (string) that links the widget with the data model
Returns:
tuple (widget, dict of i18n-strings)

widget(self, field, attr)

source code 

Render the XForms Widget.

Parameters:
  • field - the Field or a Storage with field information
  • attr - dict with XML attributes for the widget, including the mandatory "ref" attribute that links the widget to the data model

hint(self)

source code 

Render the hint for this formfield

Returns:
a <hint> element, or an empty tag if not available

label(self)

source code 

Render the label for this formfield

Returns:
a <label> element, or an empty tag if not available

setstr(self, key, string=None)

source code 

Add a translatable string to this widget

Parameters:
  • key - the key for the string
  • string - the string, or None to remove the key

getstr(self, tag, key, default=None)

source code 

Get a translated string reference

Parameters:
  • tag - the tag to wrap the string reference
  • key - the key for the string