do some lamda magic to refactor out the whitelist checking code to be shared between LMS and CMS
This commit is contained in:
11
common/djangoapps/util/sandboxing.py
Normal file
11
common/djangoapps/util/sandboxing.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import re
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
def can_execute_unsafe_code(course_id):
|
||||
# To decide if we can run unsafe code, we check the course id against
|
||||
# a list of regexes configured on the server.
|
||||
for regex in settings.COURSES_WITH_UNSAFE_CODE:
|
||||
if re.match(regex, course_id):
|
||||
return True
|
||||
return False
|
||||
Reference in New Issue
Block a user