1616
1717Settings Organization:
1818- common.py: Settings for all environments
19- - production.py: Production-specific overrides
19+ - production.py: Production-specific overrides
2020- test.py: Test environment optimizations
2121
2222Integration Points:
2525- Database connection settings for plugin models
2626- External service integration parameters
2727- Feature flags and environment-specific toggles
28- """
28+ """ # noqa: E501
2929
3030import logging
3131
@@ -48,11 +48,11 @@ def plugin_settings(settings):
4848 # Plugin-specific configuration
4949 settings.SAMPLE_PLUGIN_API_RATE_LIMIT = "60/minute"
5050 settings.SAMPLE_PLUGIN_ARCHIVE_RETENTION_DAYS = 365
51-
51+
5252 # External service integration
5353 settings.SAMPLE_PLUGIN_EXTERNAL_API_URL = "https://api.example.com"
5454 settings.SAMPLE_PLUGIN_API_KEY = "your-api-key"
55-
55+
5656 # Feature flags
5757 settings.SAMPLE_PLUGIN_ENABLE_ARCHIVING = True
5858 settings.SAMPLE_PLUGIN_ENABLE_NOTIFICATIONS = False
@@ -70,42 +70,42 @@ def plugin_settings(settings):
7070 """
7171 # Plugin is configured but no additional settings needed for this basic example
7272 # Uncomment and modify the examples below for your use case:
73-
73+
7474 # Plugin-specific configuration
7575 # settings.SAMPLE_PLUGIN_API_RATE_LIMIT = "60/minute"
7676 # settings.SAMPLE_PLUGIN_ARCHIVE_RETENTION_DAYS = 365
77-
77+
7878 # Register Open edX Filters (additive approach)
7979 _configure_openedx_filters (settings )
8080
8181
8282def _configure_openedx_filters (settings ):
8383 """
8484 Configure Open edX Filters for the sample plugin.
85-
85+
8686 This function demonstrates the proper way to register filters by:
8787 1. Preserving existing filter configuration from other plugins
8888 2. Adding our filter configuration additively
8989 3. Avoiding duplicate pipeline steps
9090 4. Logging configuration state for debugging
91-
91+
9292 Args:
9393 settings (dict): Django settings object
9494 """
9595 # Get existing filter configuration (may be from other plugins or platform)
9696 filters_config = getattr (settings , 'OPEN_EDX_FILTERS_CONFIG' , {})
97-
97+
9898 # Filter we want to register
9999 filter_name = "org.openedx.learning.course_about.page.url.requested.v1"
100100 our_pipeline_step = "sample_plugin.pipeline.ChangeCourseAboutPageUrl"
101-
101+
102102 # Check if this filter already has configuration
103103 if filter_name in filters_config :
104104 logger .debug (f"Filter { filter_name } already configured, adding our pipeline step" )
105-
105+
106106 # Get existing pipeline steps
107107 existing_pipeline = filters_config [filter_name ].get ("pipeline" , [])
108-
108+
109109 # Check if our pipeline step is already registered
110110 if our_pipeline_step in existing_pipeline :
111111 logger .info (
@@ -125,10 +125,10 @@ def _configure_openedx_filters(settings):
125125 "pipeline" : [our_pipeline_step ],
126126 "fail_silently" : False ,
127127 }
128-
128+
129129 # Update the settings object
130130 settings .OPEN_EDX_FILTERS_CONFIG = filters_config
131-
131+
132132 logger .debug (
133133 f"Final filter configuration for { filter_name } : "
134134 f"{ filters_config .get (filter_name , {})} "
0 commit comments