'Build the widget XML for the context, and add it to the layout'

def add_widget(self, layout, context):

    config = self.config
    prototype = self.widget
    contents = prototype.widget(self.agent_id, config, version=self.version, context=context)
    configbar = prototype.configbar()
    widget = DIV(configbar, contents, _class='db-widget', _id=self.agent_id)
    prototype._load_script()
    channel = config.get('channel', DEFAULT)
    position = config.get('position', None)
    layout.add_widget(widget, channel=channel, position=position)
