

def ajax(self, r, **attr):
    '\n            Render a specific widget for pulling-in via AJAX\n\n            @param r: the S3Request\n            @param attr: controller attributes\n        '
    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

dataset/ETHPy150Open sahana/eden/modules/s3/s3summary.py S3Summary.ajax/original