append some character, in this case a '_', if the course number is really a full-on number. The Wiki library interprets this incorrectly - to date we've always used non-numerical values.
This commit is contained in:
@@ -30,6 +30,19 @@ def course_wiki_redirect(request, course_id):
|
||||
course = get_course_by_id(course_id)
|
||||
|
||||
course_slug = course.wiki_slug
|
||||
|
||||
|
||||
# cdodge: fix for cases where self.location.course can be interpreted as an number rather than
|
||||
# a string. We're seeing in Studio created courses that people often will enter in a stright number
|
||||
# for 'course' (e.g. 201). This Wiki library expects a string to "do the right thing". We haven't noticed this before
|
||||
# because - to now - 'course' has always had non-numeric characters in them
|
||||
try:
|
||||
float(course_slug)
|
||||
# if the float() doesn't throw an exception, that means it's a number
|
||||
course_slug = course_slug + "_"
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
valid_slug = True
|
||||
if not course_slug:
|
||||
|
||||
Reference in New Issue
Block a user