Skip to content

Instantly share code, notes, and snippets.

View westmark's full-sized avatar

Fredrik Westmark westmark

View GitHub Profile
@westmark
westmark / restricted_python_test.py
Created February 21, 2012 13:51
Testing RestrictedPython
from RestrictedPython import compile_restricted
from RestrictedPython.PrintCollector import PrintCollector
from RestrictedPython.Guards import safe_builtins, full_write_guard
def getitem(obj, index):
if obj is not None and type(obj) in (list, tuple, dict):
return obj[index]
raise Exception()