'Render a specific widget for pulling-in via AJAX
@param r: the S3Request
@param attr: controller attributes'

def ajax(self, r, **attr):

    config = self._get_config(self.resource)
    widget_id = r.get_vars.get('w')
    i = 0
    for section in config:
        widgets = section.get('widgets', [])
        for widget in widgets:
            if (widget_id == ('summary-%s' % i)):
                method = widget.get('method', None)
                output = None
                if callable(method):
                    output = method(r, widget_id=widget_id, **attr)
                else:
                    handler = r.get_widget_handler(method)
                    if (handler is not None):
                        output = handler(r, method=method, widget_id=widget_id, **attr)
                    else:
                        r.error(405, current.ERROR.BAD_METHOD)
                return output
            i += 1
    return None
