do some lamda magic to refactor out the whitelist checking code to be shared between LMS and CMS

This commit is contained in:
Chris Dodge
2013-07-02 13:30:15 -04:00
parent 11ef3961bc
commit bf3a7287f0
3 changed files with 16 additions and 21 deletions

View 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