Package turbogears :: Package widgets :: Module forms :: Class FileField

Class FileField

source code

 object --+            
          |            
base.Widget --+        
              |        
    InputWidget --+    
                  |    
          FormField --+
                      |
                     FileField

Nested Classes

Inherited from base.Widget: __metaclass__

Instance Methods
 
display(self, value=None, **params)
Display the widget in a Genshi or Kid template.
source code
 
render(self, value=None, format='html', **params)
Exactly the same as display() but return serialized output instead.
source code

Inherited from FormField: __init__, update_params

Inherited from InputWidget: adjust_value

Inherited from base.Widget: __call__, __repr__, __setattr__, retrieve_css, retrieve_javascript

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

Class Variables
  template = '\n <input xmlns:py="http://genshi.edgewall.org/...
hash(x)
  params = ['attrs', 'field_class', 'css_classes', 'convert']
  params_doc = {'attrs': 'Dictionary containing extra (X)HTML at...
  attrs = {}
  file_upload = True
hash(x)
  engine_name = 'genshi'
hash(x)
  template_c = <MarkupTemplate "None">

Inherited from FormField: css_classes, field_class, help_text, label

Inherited from InputWidget: convert, validator

Inherited from base.Widget: css, default, javascript

Properties

Inherited from FormField: field_id, is_required, name

Inherited from InputWidget: error, fq_name, is_validated, name_path, path

Inherited from base.Widget: is_named

Inherited from object: __class__

Method Details

display(self, value=None, **params)

source code 
Display the widget in a Genshi or Kid template.

Returns a Genshi Markup stream or an ElementTree node instance,
depending on the template in which the widget shall be displayed.
If you need serialized output in a string, call 'render' instead.

Probably you will not need to override or extend if inheriting from
Widget.

@params:

value   : The value to display in the widget.
**params: Extra parameters specific to the widget. All keyword params
          supplied will pass through the update_params method which
          will have a last chance to modify them before reaching the
          template.

Overrides: base.Widget.display
(inherited documentation)

render(self, value=None, format='html', **params)

source code 

Exactly the same as display() but return serialized output instead.

Useful for debugging or to display the widget in a template other than Genshi or Kid, like Cheetah, Mako, Nevow Stan, ...

Overrides: base.Widget.render
(inherited documentation)

Class Variable Details

template

hash(x)

Value:
'''
    <input xmlns:py="http://genshi.edgewall.org/"
        type="file"
        name="${name}"
        class="${field_class}"
        id="${field_id}"
        py:attrs="attrs"
    />
...

params_doc

Value:
{'attrs': 'Dictionary containing extra (X)HTML attributes for the file\
 input tag',
 'convert': 'Should the value be coerced by the validator at display?'\
,
 'css_classes': 'List of extra CSS classes for the field',
 'field_class': 'CSS class for the field'}