'Apply method.
@param r: the S3Request
@param attr: controller options for this request'

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

    if (r.http == 'GET'):
        if (r.representation == 'html'):
            T = current.T
            output = dict(title=T('Branch    Organisational    Capacity    Assessment'))
            current.response.view = 'org/capacity_report.html'
            if attr.get('rheader'):
                rheader = attr['rheader'](r)
                if rheader:
                    output['rheader'] = rheader
            data = self._extract(r)
            if (data is None):
                output['items'] = current.response.s3.crud_strings['org_capacity_assessment'].msg_list_empty
                return output
            (indicators, orgs, consolidated) = data
            rows = []
            rappend = rows.append
            section = None
            for i in indicators:
                if (i.section != section):
                    section = i.section
                    rappend(TR(TD(section), _class='odd'))
                title = TD(('%s.    %s' % (i.number, i.name)))
                row = TR(title)
                append = row.append
                indicator_id = i.id
                values = consolidated[indicator_id]
                for v in ('A', 'B', 'C', 'D', 'E', 'F'):
                    append(TD(values[v]))
                for o in orgs:
                    rating = orgs[o].get(indicator_id, '')
                    append(TD(rating))
                rappend(row)
            orepresent = org_OrganisationRepresent(parent=False, acronym=False)
            orgs = [TH(orepresent(o)) for o in orgs]
            items = TABLE(THEAD(TR(TH('TOPICS', _rowspan=2), TH('Consolidated    Ratings', _colspan=6)), TR(TH('A'), TH('B'), TH('C'), TH('D'), TH('E'), TH('F'), *orgs)), TBODY(*rows))
            output['items'] = items
            return output
        elif (r.representation == 'xls'):
            data = self._extract(r)
            if (data is None):
                current.session.error = current.response.s3.crud_strings['org_capacity_assessment'].msg_list_empty
                redirect(URL(f='capacity_assessment', extension=''))
            return self._xls(data)
        else:
            r.error(415, current.ERROR.BAD_FORMAT)
    else:
        r.error(405, current.ERROR.BAD_METHOD)
