Skip to content

Commit 36327ff

Browse files
Taylor Paynekdmccormick
authored andcommitted
refactor: import constants into platform-wide settings module
1 parent e19577b commit 36327ff

4 files changed

Lines changed: 5 additions & 8 deletions

File tree

cms/envs/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050

5151
import lms.envs.common
5252

53-
from openedx.core.constants import COURSE_KEY_REGEX, COURSE_KEY_PATTERN, COURSE_ID_PATTERN
5453
from openedx.envs.common import * # pylint: disable=wildcard-import
5554

5655
from lms.envs.common import (

lms/envs/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
DEFAULT_ENTERPRISE_ENROLLMENT_INTENTIONS_ROLE,
6565
)
6666

67-
from openedx.core.constants import COURSE_KEY_REGEX, COURSE_KEY_PATTERN, COURSE_ID_PATTERN
6867
from openedx.core.lib.derived import Derived
6968
from openedx.core.release import doc_version
7069
from openedx.envs.common import * # pylint: disable=wildcard-import

openedx/core/constants.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@
1212
COURSE_KEY_REGEX = COURSE_KEY_PATTERN.replace('P<course_key_string>', ':')
1313
COURSE_PUBLISHED = 'published'
1414
COURSE_UNPUBLISHED = 'unpublished'
15+
16+
ASSET_KEY_PATTERN = r'(?P<asset_key_string>(?:/?c4x(:/)?/[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|(?:[^/]+))'
17+
18+
USAGE_KEY_PATTERN = r'(?P<usage_key_string>(?:i4x://?[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|(?:[^/]+))'
19+
USAGE_ID_PATTERN = USAGE_KEY_PATTERN.replace('usage_key_string', 'usage_id')

openedx/envs/common.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -780,9 +780,3 @@ def _make_locale_paths(settings):
780780
# in the AccountCreationForm and the user_api through the ENABLE_UNICODE_USERNAME feature flag.
781781
USERNAME_REGEX_PARTIAL = r'[\w .@_+-]+'
782782
USERNAME_PATTERN = fr'(?P<username>{USERNAME_REGEX_PARTIAL})'
783-
784-
# These are standard regexes for pulling out info like course_ids, usage_ids, etc.
785-
# They are used so that URLs with deprecated-format strings still work.
786-
USAGE_KEY_PATTERN = r'(?P<usage_key_string>(?:i4x://?[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|(?:[^/]+))'
787-
ASSET_KEY_PATTERN = r'(?P<asset_key_string>(?:/?c4x(:/)?/[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|(?:[^/]+))'
788-
USAGE_ID_PATTERN = r'(?P<usage_id>(?:i4x://?[^/]+/[^/]+/[^/]+/[^@]+(?:@[^/]+)?)|(?:[^/]+))'

0 commit comments

Comments
 (0)