Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ecommerce
Commits
4b72e75d
Commit
4b72e75d
authored
Feb 02, 2017
by
Clinton Blackburn
Committed by
Clinton Blackburn
Feb 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor cleanup of strings
ECOM-6975
parent
f75493ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
11 deletions
+9
-11
ecommerce/core/constants.py
+7
-9
ecommerce/extensions/fulfillment/modules.py
+2
-2
No files found.
ecommerce/core/constants.py
View file @
4b72e75d
"""Constants core to the ecommerce app."""
"""Constants core to the ecommerce app."""
from
__future__
import
unicode_literals
ISO_8601_FORMAT
=
u'
%
Y-
%
m-
%
dT
%
H:
%
M:
%
SZ'
ISO_8601_FORMAT
=
'
%
Y-
%
m-
%
dT
%
H:
%
M:
%
SZ'
# Regex used to match course IDs.
# Regex used to match course IDs.
COURSE_ID_REGEX
=
r'[^/+]+(/|\+)[^/+]+(/|\+)[^/]+'
COURSE_ID_REGEX
=
r'[^/+]+(/|\+)[^/+]+(/|\+)[^/]+'
COURSE_ID_PATTERN
=
r'(?P<course_id>{})'
.
format
(
COURSE_ID_REGEX
)
COURSE_ID_PATTERN
=
r'(?P<course_id>{})'
.
format
(
COURSE_ID_REGEX
)
# Seat constants
# Seat constants
SEAT_PRODUCT_CLASS_NAME
=
"Seat"
SEAT_PRODUCT_CLASS_NAME
=
'Seat'
# Enrollment Code constants
# Enrollment Code constants
ENROLLMENT_CODE_PRODUCT_CLASS_NAME
=
'Enrollment Code'
ENROLLMENT_CODE_PRODUCT_CLASS_NAME
=
'Enrollment Code'
...
@@ -23,11 +21,11 @@ DEFAULT_CATALOG_PAGE_SIZE = 100
...
@@ -23,11 +21,11 @@ DEFAULT_CATALOG_PAGE_SIZE = 100
class
Status
(
object
):
class
Status
(
object
):
"""Health statuses."""
"""Health statuses."""
OK
=
u"OK"
OK
=
'OK'
UNAVAILABLE
=
u"UNAVAILABLE"
UNAVAILABLE
=
'UNAVAILABLE'
class
UnavailabilityMessage
(
object
):
class
UnavailabilityMessage
(
object
):
"""Messages to be logged when services are unavailable."""
"""Messages to be logged when services are unavailable."""
DATABASE
=
u"Unable to connect to database"
DATABASE
=
'Unable to connect to database'
LMS
=
u"Unable to connect to LMS"
LMS
=
'Unable to connect to LMS'
ecommerce/extensions/fulfillment/modules.py
View file @
4b72e75d
...
@@ -15,7 +15,7 @@ from rest_framework import status
...
@@ -15,7 +15,7 @@ from rest_framework import status
import
requests
import
requests
from
requests.exceptions
import
ConnectionError
,
Timeout
from
requests.exceptions
import
ConnectionError
,
Timeout
from
ecommerce.core.constants
import
ENROLLMENT_CODE_PRODUCT_CLASS_NAME
from
ecommerce.core.constants
import
ENROLLMENT_CODE_PRODUCT_CLASS_NAME
,
SEAT_PRODUCT_CLASS_NAME
from
ecommerce.core.url_utils
import
get_lms_enrollment_api_url
from
ecommerce.core.url_utils
import
get_lms_enrollment_api_url
from
ecommerce.courses.models
import
Course
from
ecommerce.courses.models
import
Course
from
ecommerce.courses.utils
import
mode_for_seat
from
ecommerce.courses.utils
import
mode_for_seat
...
@@ -125,7 +125,7 @@ class EnrollmentFulfillmentModule(BaseFulfillmentModule):
...
@@ -125,7 +125,7 @@ class EnrollmentFulfillmentModule(BaseFulfillmentModule):
return
requests
.
post
(
enrollment_api_url
,
data
=
json
.
dumps
(
data
),
headers
=
headers
,
timeout
=
timeout
)
return
requests
.
post
(
enrollment_api_url
,
data
=
json
.
dumps
(
data
),
headers
=
headers
,
timeout
=
timeout
)
def
supports_line
(
self
,
line
):
def
supports_line
(
self
,
line
):
return
line
.
product
.
get_product_class
()
.
name
==
'Seat'
return
line
.
product
.
get_product_class
()
.
name
==
SEAT_PRODUCT_CLASS_NAME
def
get_supported_lines
(
self
,
lines
):
def
get_supported_lines
(
self
,
lines
):
""" Return a list of lines that can be fulfilled through enrollment.
""" Return a list of lines that can be fulfilled through enrollment.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment