def _import_plugins(self):
        """
        Internal function, ensure all plugin packages are imported.
        """
        if self.detected:
            return

        # In some cases, plugin scanning may start during a request.
        # Make sure there is only one thread scanning for plugins.
        self.scanLock.acquire()
        if self.detected:
            return  # previous threaded released + completed

        try:
            import_apps_submodule("content_plugins")
            self.detected = True
        finally:
            self.scanLock.release()
    def _import_plugins(self):
        """
        Internal function, ensure all plugin packages are imported.
        """
        if self.detected:
            return

        try:
            # In some cases, plugin scanning may start during a request.
            # Make sure there is only one thread scanning for plugins.
            self.scanLock.acquire()
            if self.detected:
                return  # previous threaded released + completed

            import_apps_submodule("content_plugins")
            self.detected = True
        finally:
            self.scanLock.release()
Exemple #3
0
 def test_import_apps_submodule(self):
     expected = [
         'django.contrib.auth', 'django.contrib.contenttypes',
         'django.contrib.sites'
     ]
     self.assertEqual(import_apps_submodule('admin'), expected)
 def test_import_apps_submodule(self):
     expected = ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sites']
     self.assertEqual(import_apps_submodule('admin'), expected)