On second thought, make can_execute_unsafe_code a function returning a boolean.
This commit is contained in:
@@ -702,7 +702,7 @@ class ModuleSystem(object):
|
||||
open_ended_grading_interface=None,
|
||||
s3_interface=None,
|
||||
cache=None,
|
||||
can_execute_unsafe_code=False,
|
||||
can_execute_unsafe_code=None,
|
||||
):
|
||||
'''
|
||||
Create a closure around the system environment.
|
||||
@@ -750,8 +750,8 @@ class ModuleSystem(object):
|
||||
.get(key) returns an object from the cache or None.
|
||||
.set(key, value, timeout_secs=None) stores a value in the cache with a timeout.
|
||||
|
||||
can_execute_unsafe_code - A boolean, whether or not to allow the execution
|
||||
of unsafe, unsandboxed code.
|
||||
can_execute_unsafe_code - A function returning a boolean, whether or
|
||||
not to allow the execution of unsafe, unsandboxed code.
|
||||
|
||||
'''
|
||||
self.ajax_url = ajax_url
|
||||
@@ -778,7 +778,7 @@ class ModuleSystem(object):
|
||||
self.s3_interface = s3_interface
|
||||
|
||||
self.cache = cache or DoNothingCache()
|
||||
self.can_execute_unsafe_code = can_execute_unsafe_code
|
||||
self.can_execute_unsafe_code = can_execute_unsafe_code or (lambda: False)
|
||||
|
||||
def get(self, attr):
|
||||
''' provide uniform access to attributes (like etree).'''
|
||||
|
||||
Reference in New Issue
Block a user