def apply_method(self, r, **attr):
        """
            API entry point

            @param r: the S3Request instance
            @param attr: controller attributes for the request
        """

        if r.http in ("GET", "POST", "DELETE"):
            if r.record:
                # Initialize CRUD form
                self.settings = current.response.s3.crud
                self.sqlform = sqlform = self._config("crud_form")
                if not sqlform:
                    from s3forms import S3SQLDefaultForm
                    self.sqlform = S3SQLDefaultForm()

                # Render page
                output = self.profile(r, **attr)

            elif ("dl", "aadata") not in r.representation:
                # Redirect to the List View
                redirect(r.url(method=""))

            else:
                # No point redirecting
                r.error(404, current.ERROR.BAD_RECORD)
        else:
            r.error(405, current.ERROR.BAD_METHOD)
        return output

    # -------------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/modules/s3/s3profile.py/S3Profile.apply_method/swapped operands of `not in`