'Entry point for REST controller
@param r: the S3Request
@param attr: dict of controller parameters'

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

    if (r.representation in ('html', 'iframe')):
        if (r.http in ('GET', 'POST')):
            output = self.create_form(r, **attr)
        else:
            r.error(405, current.ERROR.BAD_METHOD)
    else:
        r.error(415, current.ERROR.BAD_FORMAT)
    return output
