Files
edx-platform/lms/djangoapps/utils.py
usama sadiq 7719314a22 Upgrade to Python3
Added absolute_import
Changed the use of unicode with six.text_type
2019-06-21 16:39:24 +05:00

17 lines
368 B
Python

"""
Helper Methods
"""
import six
def _get_key(key_or_id, key_cls):
"""
Helper method to get a course/usage key either from a string or a key_cls,
where the key_cls (CourseKey or UsageKey) will simply be returned.
"""
return (
key_cls.from_string(key_or_id)
if isinstance(key_or_id, six.string_types)
else key_or_id
)