Use replace for manipulating CourseLocator, so that deprecation is preserved

Docstring needs to be updated.