Package turbogears :: Package widgets :: Module base :: Class JSLink

Class JSLink

source code

object --+            
    Widget --+        
      Resource --+    
              Link --+
Known Subclasses:

A JavaScript link.

Nested Classes

Inherited from Widget: __metaclass__

Instance Methods
__init__(self, *args, **kw)
Widget initialization.
source code
Return the needed CSS ressources.
source code

Inherited from Link: __eq__, __hash__, update_params

Inherited from Widget: __call__, __repr__, __setattr__, adjust_value, display, render, retrieve_css

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

Class Variables
  template = '\n <script type="text/javascript" src="$link"\n...
  params = ['charset', 'defer', 'order']
  params_doc = {'charset': 'The character encoding of the linked...
  charset = load_kid_template(...
  defer = False
  location = 'head'

Inherited from Resource: order

Inherited from Widget: css, default, javascript, name


Inherited from Widget: is_named

Inherited from object: __class__

Method Details

__init__(self, *args, **kw)

source code 
Widget initialization.

All initialization has to take place in this method.
It's not thread-safe to mutate widget's attributes outside this method
or anytime after widget's first display.

*Must* call super(MyWidget, self).__init__(*args, **kw) cooperatively,
unless, of course, your know what you're doing. Preferably this should
be done before any actual work is done in the method.


name     : The widget's name. In input widgets, this will also be the
           name of the variable that the form will send to the
           controller. This is the only param that is safe to pass as a
           positional argument to __init__.
template : The template that the widget should use to display itself.
           Currently only Kid templates are supported. You can both
           initialize with a template string or with the path to a
           file-base template: "myapp.templates.widget_tmpl"
default  : Default value to display when no value is passed at display
**params : Keyword arguments specific to your widget or to any of it's
           bases. If listed at class attribute 'params' the will be
           bound automatically to the widget instance.

Note: Do not confuse these parameters with parameters listed at
"params". Some widgets accept parameters at the constructor which are
not listed params, these parameter won't be passed to the template, be
automatically called, etc..

Overrides: object.__init__
(inherited documentation)


source code 

Return the needed CSS ressources.

Return a setlike instance with all the CSSLinks and CSSSources the widget needs.

Overrides: Widget.retrieve_javascript
(inherited documentation)

Class Variable Details



    <script type="text/javascript" src="$link"
        charset="$charset" defer="${defer and \'defer\' or None}"/>


{'charset': 'The character encoding of the linked script',
 'defer': 'If true, browser may defer execution of the script',
 'order': 'JS and CSS are sorted in this \'order\' at render time'}


    <div xmlns:py="" py:content="for_widget.dis\
""") [0]