Skip to content
Snippets Groups Projects
Commit 398a8a2b authored by Luis Moreno's avatar Luis Moreno
Browse files

Fix python 3.8 compatibility

parent 41543edd
Branches
Tags
No related merge requests found
......@@ -32,6 +32,12 @@ from xmodule.errortracker import make_error_tracker
from .exceptions import InsufficientSpecificationError, InvalidLocationError
# The name of the type for patterns in re changed in Python 3.7.
try:
Pattern = re._pattern_type # pylint: disable=protected-access
except AttributeError:
Pattern = re.Pattern # pylint: disable=no-member
log = logging.getLogger('edx.modulestore')
new_contract('CourseKey', CourseKey)
......@@ -899,7 +905,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
"""
if isinstance(target, list):
return any(self._value_matches(ele, criteria) for ele in target)
elif isinstance(criteria, re._pattern_type): # pylint: disable=protected-access
elif isinstance(criteria, Pattern):
return criteria.search(target) is not None
elif callable(criteria):
return criteria(target)
......
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