Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2076,9 +2076,11 @@

############## Installed Django Apps #########################

from openedx.core.djangoapps.plugins import plugin_apps, plugin_settings, constants as plugin_constants
INSTALLED_APPS.extend(plugin_apps.get_apps(plugin_constants.ProjectType.CMS))
plugin_settings.add_plugins(__name__, plugin_constants.ProjectType.CMS, plugin_constants.SettingsType.COMMON)
from edx_django_utils.plugins import get_plugin_apps, add_plugins
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType

INSTALLED_APPS.extend(get_plugin_apps(ProjectType.CMS))
Comment thread
jinder1s marked this conversation as resolved.
add_plugins(__name__, ProjectType.CMS, SettingsType.COMMON)

# Course exports streamed in blocks of this size. 8192 or 8kb is the default
# setting for the FileWrapper class used to iterate over the export file data.
Expand Down
6 changes: 4 additions & 2 deletions cms/envs/devstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,11 @@ def should_show_debug_toolbar(request):
#####################################################################

# pylint: disable=wrong-import-order, wrong-import-position
from openedx.core.djangoapps.plugins import constants as plugin_constants, plugin_settings
from edx_django_utils.plugins import add_plugins
# pylint: disable=wrong-import-order, wrong-import-position
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType

plugin_settings.add_plugins(__name__, plugin_constants.ProjectType.CMS, plugin_constants.SettingsType.DEVSTACK)
add_plugins(__name__, ProjectType.CMS, SettingsType.DEVSTACK)


OPENAPI_CACHE_TIMEOUT = 0
Expand Down
7 changes: 4 additions & 3 deletions cms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
from corsheaders.defaults import default_headers as corsheaders_default_headers
from django.core.exceptions import ImproperlyConfigured
from django.urls import reverse_lazy
from edx_django_utils.plugins import add_plugins
Comment thread
jinder1s marked this conversation as resolved.
from path import Path as path

from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType
Comment thread
jinder1s marked this conversation as resolved.

from .common import *

from openedx.core.djangoapps.plugins import constants as plugin_constants
from openedx.core.djangoapps.plugins import plugin_settings
from openedx.core.lib.derived import derive_settings
from openedx.core.lib.logsettings import get_logger_config
from xmodule.modulestore.modulestore_settings import convert_module_store_setting_if_needed
Expand Down Expand Up @@ -539,7 +540,7 @@ def get_env_setting(setting):

# This is at the bottom because it is going to load more settings after base settings are loaded

plugin_settings.add_plugins(__name__, plugin_constants.ProjectType.CMS, plugin_constants.SettingsType.PRODUCTION)
add_plugins(__name__, ProjectType.CMS, SettingsType.PRODUCTION)

########################## Derive Any Derived Settings #######################

Expand Down
8 changes: 5 additions & 3 deletions cms/envs/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,11 @@

####################### Plugin Settings ##########################

# pylint: disable=wrong-import-position
from openedx.core.djangoapps.plugins import plugin_settings, constants as plugin_constants
plugin_settings.add_plugins(__name__, plugin_constants.ProjectType.CMS, plugin_constants.SettingsType.TEST)
# pylint: disable=wrong-import-position, wrong-import-order
from edx_django_utils.plugins import add_plugins
# pylint: disable=wrong-import-position, wrong-import-order
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType
add_plugins(__name__, ProjectType.CMS, SettingsType.TEST)

########################## Derive Any Derived Settings #######################

Expand Down
7 changes: 5 additions & 2 deletions cms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,11 @@
url(r'coverage_context', include('openedx.testing.coverage_context_listener.urls'))
]

from openedx.core.djangoapps.plugins import constants as plugin_constants, plugin_urls
urlpatterns.extend(plugin_urls.get_patterns(plugin_constants.ProjectType.CMS))
# pylint: disable=wrong-import-position, wrong-import-order
from edx_django_utils.plugins import get_plugin_url_patterns
# pylint: disable=wrong-import-position
from openedx.core.djangoapps.plugins.constants import ProjectType
urlpatterns.extend(get_plugin_url_patterns(ProjectType.CMS))

# Contentstore
urlpatterns += [
Expand Down
6 changes: 3 additions & 3 deletions common/djangoapps/student/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from django.utils.translation import ugettext as _
from django.views.decorators.csrf import ensure_csrf_cookie
from edx_django_utils import monitoring as monitoring_utils
from edx_django_utils.plugins import get_plugins_view_context
from opaque_keys.edx.keys import CourseKey
from pytz import UTC
from six import iteritems, text_type
Expand All @@ -35,8 +36,7 @@
get_visible_sessions_for_entitlement
)
from openedx.core.djangoapps.credit.email_utils import get_credit_provider_attribute_values, make_providers_strings
from openedx.core.djangoapps.plugins import constants as plugin_constants
from openedx.core.djangoapps.plugins.plugin_contexts import get_plugins_view_context
from openedx.core.djangoapps.plugins.constants import ProjectType
from openedx.core.djangoapps.programs.models import ProgramsApiConfig
from openedx.core.djangoapps.programs.utils import ProgramDataExtender, ProgramProgressMeter
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
Expand Down Expand Up @@ -800,7 +800,7 @@ def student_dashboard(request):
}

context_from_plugins = get_plugins_view_context(
plugin_constants.ProjectType.LMS,
ProjectType.LMS,
COURSE_DASHBOARD_PLUGIN_VIEW_NAME,
context
)
Expand Down
2 changes: 1 addition & 1 deletion common/lib/xmodule/xmodule/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from six import text_type
from xblock.fields import List

from openedx.core.lib.plugins import PluginError
from edx_django_utils.plugins import PluginError

log = logging.getLogger("edx.courseware")

Expand Down
6 changes: 3 additions & 3 deletions docs/guides/extension_points.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ If you wish to customize aspects of the learner or educator experiences, you'll

Most python plugins are enabled using one of two methods:

1. A Python Entry point: the core Open edX platform provides a standard plugin loading mechanism in |openedx.core.lib.plugins|_ which uses `stevedore`_ to find all installed python packages that declare a specific "entry point" in their setup.py file. See the ``entry_points`` defined in edx-platform's own ``setup.py`` for examples.
1. A Python Entry point: the core Open edX platform provides a standard plugin loading mechanism in |edx_django_utils.plugins|_ which uses `stevedore`_ to find all installed python packages that declare a specific "entry point" in their setup.py file. See the ``entry_points`` defined in edx-platform's own ``setup.py`` for examples.
2. A Django setting: Some plugins require modification of Django settings, which is typically done by editing ``/edx/etc/lms.yml`` (in Production) or ``edx-platform/lms/envs/private.py`` (on Devstack).

.. |openedx.core.lib.plugins| replace:: ``openedx.core.lib.plugins``
.. _openedx.core.lib.plugins: https://github.com/edx/edx-platform/blob/master/openedx/core/lib/plugins.py
.. |edx_django_utils.plugins| replace:: ``edx_django_utils.plugins``
.. _edx_django_utils.plugins: https://github.com/edx/edx-django-utils/blob/master/edx_django_utils/plugins
.. _stevedore: https://pypi.org/project/stevedore/

Here are the different integration points that python plugins can use:
Expand Down
1 change: 0 additions & 1 deletion lms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
registration and discovery can work correctly.
"""


# We monkey patch Kombu's entrypoints listing because scanning through this
# accounts for the majority of LMS/Studio startup time for tests, and we don't
# use custom Kombu serializers (which is what this is for). Still, this is
Expand Down
3 changes: 2 additions & 1 deletion lms/djangoapps/discussion/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@


from django.apps import AppConfig
from edx_django_utils.plugins import PluginSettings, PluginURLs

from openedx.core.constants import COURSE_ID_PATTERN
from openedx.core.djangoapps.plugins.constants import PluginSettings, PluginURLs, ProjectType, SettingsType
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType


class DiscussionConfig(AppConfig):
Expand Down
3 changes: 2 additions & 1 deletion lms/djangoapps/grades/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

from django.apps import AppConfig
from django.conf import settings
from edx_django_utils.plugins import PluginSettings, PluginURLs
from edx_proctoring.runtime import set_runtime_service

from openedx.core.djangoapps.plugins.constants import PluginSettings, PluginURLs, ProjectType, SettingsType
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType


class GradesConfig(AppConfig):
Expand Down
3 changes: 2 additions & 1 deletion lms/djangoapps/instructor/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

from django.apps import AppConfig
from django.conf import settings
from edx_django_utils.plugins import PluginSettings, PluginURLs
Comment thread
jinder1s marked this conversation as resolved.
from edx_proctoring.runtime import set_runtime_service

from openedx.core.constants import COURSE_ID_PATTERN
from openedx.core.djangoapps.plugins.constants import PluginSettings, PluginURLs, ProjectType, SettingsType
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType


class InstructorConfig(AppConfig):
Expand Down
3 changes: 2 additions & 1 deletion lms/djangoapps/program_enrollments/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@


from django.apps import AppConfig
from edx_django_utils.plugins import PluginURLs
Comment thread
jinder1s marked this conversation as resolved.

from openedx.core.djangoapps.plugins.constants import PluginURLs, ProjectType
from openedx.core.djangoapps.plugins.constants import ProjectType


class ProgramEnrollmentsConfig(AppConfig):
Expand Down
8 changes: 5 additions & 3 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3880,9 +3880,11 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring

############## Plugin Django Apps #########################

from openedx.core.djangoapps.plugins import plugin_apps, plugin_settings, constants as plugin_constants
INSTALLED_APPS.extend(plugin_apps.get_apps(plugin_constants.ProjectType.LMS))
plugin_settings.add_plugins(__name__, plugin_constants.ProjectType.LMS, plugin_constants.SettingsType.COMMON)
from edx_django_utils.plugins import get_plugin_apps, add_plugins
# pylint: disable=wrong-import-position, wrong-import-order
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType
INSTALLED_APPS.extend(get_plugin_apps(ProjectType.LMS))
add_plugins(__name__, ProjectType.LMS, SettingsType.COMMON)

DEPRECATED_ADVANCED_COMPONENT_TYPES = []

Expand Down
7 changes: 4 additions & 3 deletions lms/envs/devstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

# pylint: enable=unicode-format-string
#####################################################################
from openedx.core.djangoapps.plugins import constants as plugin_constants
from openedx.core.djangoapps.plugins import plugin_settings
from edx_django_utils.plugins import add_plugins

from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType

from .production import * # pylint: disable=wildcard-import, unused-wildcard-import

Expand Down Expand Up @@ -308,7 +309,7 @@ def should_show_debug_toolbar(request):
'y5ZLcTUomo4rZLjghVpq6KZxfS6I1Vz79ZsMVUWEdXOYePCKKsrQG20ogQEkmTf9FT_SouC6jPcHLXw"}]}'
),
})
plugin_settings.add_plugins(__name__, plugin_constants.ProjectType.LMS, plugin_constants.SettingsType.DEVSTACK)
add_plugins(__name__, ProjectType.LMS, SettingsType.DEVSTACK)


######################### Django Rest Framework ########################
Expand Down
5 changes: 3 additions & 2 deletions lms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
import yaml
from corsheaders.defaults import default_headers as corsheaders_default_headers
from django.core.exceptions import ImproperlyConfigured
from edx_django_utils.plugins import add_plugins
Comment thread
jinder1s marked this conversation as resolved.
Comment thread
jinder1s marked this conversation as resolved.
from path import Path as path

from openedx.core.djangoapps.plugins import plugin_settings, constants as plugin_constants
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType
from openedx.core.lib.derived import derive_settings
from openedx.core.lib.logsettings import get_logger_config
from xmodule.modulestore.modulestore_settings import convert_module_store_setting_if_needed
Expand Down Expand Up @@ -949,7 +950,7 @@ def get_env_setting(setting):
# This is at the bottom because it is going to load more settings after base settings are loaded

# Load production.py in plugins
plugin_settings.add_plugins(__name__, plugin_constants.ProjectType.LMS, plugin_constants.SettingsType.PRODUCTION)
add_plugins(__name__, ProjectType.LMS, SettingsType.PRODUCTION)

########################## Derive Any Derived Settings #######################

Expand Down
5 changes: 3 additions & 2 deletions lms/envs/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@

import openid.oidutil
from django.utils.translation import ugettext_lazy
from edx_django_utils.plugins import add_plugins
from path import Path as path
from six.moves import range

from openedx.core.djangoapps.plugins import plugin_settings, constants as plugin_constants
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType
from openedx.core.lib.derived import derive_settings
from openedx.core.lib.tempdir import mkdtemp_clean

Expand Down Expand Up @@ -557,7 +558,7 @@
# pylint: enable=unicode-format-string
####################### Plugin Settings ##########################

plugin_settings.add_plugins(__name__, plugin_constants.ProjectType.LMS, plugin_constants.SettingsType.TEST)
add_plugins(__name__, ProjectType.LMS, SettingsType.TEST)

########################## Derive Any Derived Settings #######################

Expand Down
6 changes: 3 additions & 3 deletions lms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from django.utils.translation import ugettext_lazy as _
from django.views.generic.base import RedirectView
from edx_api_doc_tools import make_docs_urls
from edx_django_utils.plugins import get_plugin_url_patterns
Comment thread
jinder1s marked this conversation as resolved.
Comment thread
jinder1s marked this conversation as resolved.
from ratelimitbackend import admin

from branding import views as branding_views
Expand Down Expand Up @@ -41,8 +42,7 @@
from openedx.core.djangoapps.lang_pref import views as lang_pref_views
from openedx.core.djangoapps.password_policy import compliance as password_policy_compliance
from openedx.core.djangoapps.password_policy.forms import PasswordPolicyAwareAdminAuthForm
from openedx.core.djangoapps.plugins import constants as plugin_constants
from openedx.core.djangoapps.plugins import plugin_urls
from openedx.core.djangoapps.plugins.constants import ProjectType
from openedx.core.djangoapps.programs.models import ProgramsApiConfig
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
Expand Down Expand Up @@ -961,7 +961,7 @@
),
)

urlpatterns.extend(plugin_urls.get_patterns(plugin_constants.ProjectType.LMS))
urlpatterns.extend(get_plugin_url_patterns(ProjectType.LMS))

# Course Home API urls
urlpatterns += [
Expand Down
3 changes: 2 additions & 1 deletion openedx/core/djangoapps/ace_common/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from edx_django_utils.plugins import PluginSettings
Comment thread
jinder1s marked this conversation as resolved.

from openedx.core.djangoapps.plugins.constants import PluginSettings, ProjectType, SettingsType
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType


class AceCommonConfig(AppConfig):
Expand Down
3 changes: 2 additions & 1 deletion openedx/core/djangoapps/bookmarks/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from edx_django_utils.plugins import PluginSettings, PluginURLs
Comment thread
jinder1s marked this conversation as resolved.

from openedx.core.djangoapps.plugins.constants import PluginSettings, PluginURLs, ProjectType, SettingsType
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType


class BookmarksConfig(AppConfig):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from hashlib import sha1

import six
from edx_django_utils.plugins import PluginManager

from openedx.core.lib.cache_utils import process_cached
from openedx.core.lib.plugins import PluginManager


class TransformerRegistry(PluginManager):
Expand Down
3 changes: 2 additions & 1 deletion openedx/core/djangoapps/content_libraries/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@


from django.apps import AppConfig
from edx_django_utils.plugins import PluginURLs, PluginSettings
Comment thread
jinder1s marked this conversation as resolved.

from openedx.core.djangoapps.plugins.constants import ProjectType, PluginURLs, PluginSettings
from openedx.core.djangoapps.plugins.constants import ProjectType


class ContentLibrariesConfig(AppConfig):
Expand Down
3 changes: 2 additions & 1 deletion openedx/core/djangoapps/courseware_api/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@


from django.apps import AppConfig
from edx_django_utils.plugins import PluginURLs
Comment thread
jinder1s marked this conversation as resolved.

from openedx.core.djangoapps.plugins.constants import PluginURLs, ProjectType
from openedx.core.djangoapps.plugins.constants import ProjectType


class CoursewareAPIConfig(AppConfig):
Expand Down
3 changes: 2 additions & 1 deletion openedx/core/djangoapps/credentials/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from edx_django_utils.plugins import PluginSettings, PluginSignals
Comment thread
jinder1s marked this conversation as resolved.

from openedx.core.djangoapps.plugins.constants import PluginSettings, PluginSignals, ProjectType, SettingsType
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType


class CredentialsConfig(AppConfig):
Expand Down
3 changes: 2 additions & 1 deletion openedx/core/djangoapps/olx_rest_api/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
olx_rest_api Django application initialization.
"""
from django.apps import AppConfig
from edx_django_utils.plugins import PluginURLs
Comment thread
jinder1s marked this conversation as resolved.

from openedx.core.djangoapps.plugins.constants import PluginURLs, ProjectType
from openedx.core.djangoapps.plugins.constants import ProjectType


class OlxRestApiAppConfig(AppConfig):
Expand Down
3 changes: 2 additions & 1 deletion openedx/core/djangoapps/password_policy/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
from django.apps import AppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from edx_django_utils.plugins import PluginSettings
Comment thread
jinder1s marked this conversation as resolved.

from openedx.core.djangoapps.plugins.constants import PluginSettings, ProjectType, SettingsType
from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType

log = logging.getLogger(__name__)

Expand Down
Loading