File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ import logging
2+ import re
3+
4+ from openedx_filters .filters import PipelineStep
5+
6+ logger = logging .getLogger (__name__ )
7+
8+
9+ class ChangeCourseAboutPageUrl (PipelineStep ):
10+ def run_filter (self , url , org , ** kwargs ):
11+ """
12+ The `run_filter` function must return eiter a dictonary with keys matching the names of the params passed in, or
13+ none. More info can be found in the run_filter base docs:
14+ https://docs.openedx.org/projects/openedx-filters/en/latest/reference/filters-tooling.html#openedx_filters.filters.PipelineStep.run_filter
15+ """
16+
17+ # Extract the course ID from the existing URL
18+ pattern = r'(?P<course_id>course-v1:[^/]+)'
19+
20+ match = re .search (pattern , url )
21+ if match :
22+ course_id = match .group ('course_id' )
23+ new_url = f"https://example.com/new_about_page/{ course_id } "
24+ logging .debug (f"Replacing old course about url for { course_id } with a different site." )
25+ return {"url" : new_url , "org" : org }
26+
27+ data = {"url" : url , "org" : org }
28+ return data
You can’t perform that action at this time.
0 commit comments