Use replace for manipulating CourseLocator, so that deprecation is preserved

What in the doc string needs to change? The behavior of the new and old versions of the function should be identical.