@classmethod
    def installed(cls):
        """
        Used in ``mezzanine.pages.views.page`` to ensure
        ``PageMiddleware`` or a subclass has been installed. We cache
        the result on the ``PageMiddleware._installed`` to only run
        this once. Short path is to just check for the dotted path to
        ``PageMiddleware`` in ``MIDDLEWARE_CLASSES`` - if not found,
        we need to load each middleware class to match a subclass.
        """
        try:
            return cls._installed
        except __HOLE__:
            name = "mezzanine.pages.middleware.PageMiddleware"
            installed = name in settings.MIDDLEWARE_CLASSES
            if not installed:
                for name in settings.MIDDLEWARE_CLASSES:
                    if issubclass(import_dotted_path(name), cls):
                        installed = True
                        break
            setattr(cls, "_installed", installed)
            return installed
dataset/ETHPy150Open stephenmcd/mezzanine/mezzanine/pages/middleware.py/PageMiddleware.installed