Discssions as a plugin

This commit is contained in:
Bill DeRusha
2018-02-16 14:39:59 -05:00
parent 15e07d7cc5
commit 4fba472139
12 changed files with 51 additions and 32 deletions

12
openedx/core/constants.py Normal file
View File

@@ -0,0 +1,12 @@
"""
Constants that are relevant all of Open edX
"""
# These are standard regexes for pulling out info like course_ids, usage_ids, etc.
# They are used so that URLs with deprecated-format strings still work.
# Note: these intentionally greedily grab all chars up to the next slash includingny pluses
# DHM: I really wanted to ensure the separators were the same (+ or /) but all patts tried had
# too many inadvertent side effects :-(
COURSE_KEY_PATTERN = r'(?P<course_key_string>[^/+]+(/|\+)[^/+]+(/|\+)[^/?]+)'
COURSE_ID_PATTERN = COURSE_KEY_PATTERN.replace('course_key_string', 'course_id')
COURSE_KEY_REGEX = COURSE_KEY_PATTERN.replace('P<course_key_string>', ':')