Commit 4b72e75d by Clinton Blackburn Committed by Clinton Blackburn

Minor cleanup of strings

ECOM-6975
parent f75493ca
"""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.
COURSE_ID_REGEX = r'[^/+]+(/|\+)[^/+]+(/|\+)[^/]+'
COURSE_ID_PATTERN = r'(?P<course_id>{})'.format(COURSE_ID_REGEX)
# Seat constants
SEAT_PRODUCT_CLASS_NAME = "Seat"
SEAT_PRODUCT_CLASS_NAME = 'Seat'
# Enrollment Code constants
ENROLLMENT_CODE_PRODUCT_CLASS_NAME = 'Enrollment Code'
......@@ -23,11 +21,11 @@ DEFAULT_CATALOG_PAGE_SIZE = 100
class Status(object):
"""Health statuses."""
OK = u"OK"
UNAVAILABLE = u"UNAVAILABLE"
OK = 'OK'
UNAVAILABLE = 'UNAVAILABLE'
class UnavailabilityMessage(object):
"""Messages to be logged when services are unavailable."""
DATABASE = u"Unable to connect to database"
LMS = u"Unable to connect to LMS"
DATABASE = 'Unable to connect to database'
LMS = 'Unable to connect to LMS'
......@@ -15,7 +15,7 @@ from rest_framework import status
import requests
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.courses.models import Course
from ecommerce.courses.utils import mode_for_seat
......@@ -125,7 +125,7 @@ class EnrollmentFulfillmentModule(BaseFulfillmentModule):
return requests.post(enrollment_api_url, data=json.dumps(data), headers=headers, timeout=timeout)
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):
""" Return a list of lines that can be fulfilled through enrollment.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment