Exemplo n.º 1
0
    def ri_exec(self, code):
        """Execute Python code in a restricted environment.

        The value of code can be either source or binary code."""
        if isinstance(code, basestring):
            code = compile(code, '<string>', 'exec')
        self.globals['__builtins__'] = SafeBuiltins
        exec code in self.globals, self.locals
Exemplo n.º 2
0
    def ri_exec(self, code):
        """Execute Python code in a restricted environment.

        The value of code can be either source or binary code."""
        if isinstance(code, basestring):
            code = compile(code, "<string>", "exec")
        self.globals["__builtins__"] = SafeBuiltins
        exec code in self.globals, self.locals
Exemplo n.º 3
0
 def __init__(self, source, filename="<string>"):
     self.source = source
     self.code = compile(source, filename, "exec")
Exemplo n.º 4
0
def exec_src(source, globals, locals=None):
    globals["__builtins__"] = SafeBuiltins
    code = compile(source, "<string>", "exec")
    exec code in globals, locals
Exemplo n.º 5
0
 def _compile(self, text, filename):
     return rcompile.compile(text, filename, 'eval')
Exemplo n.º 6
0
 def _compile(self, text, filename):
     return rcompile.compile(text, filename, 'eval')
Exemplo n.º 7
0
 def __init__(self, source, filename='<string>'):
     self.source = source
     self.code = compile(source, filename, 'exec')
Exemplo n.º 8
0
def exec_src(source, globals, locals=None):
    globals['__builtins__'] = SafeBuiltins
    code = compile(source, '<string>', 'exec')
    exec code in globals, locals
Exemplo n.º 9
0
 def compile_python_expresssion(self, src):
     return compile(src, getattr(self, '__name__', '<string>'), 'eval')
Exemplo n.º 10
0
 def __init__(self, source, filename='<string>'):
     self.source = source
     self.code = compile(source, filename, 'exec')
Exemplo n.º 11
0
def exec_src(source, globals, locals=None):
    globals['__builtins__'] = SafeBuiltins
    code = compile(source, '<string>', 'exec')
    exec code in globals, locals