Scribus
Open source desktop publishing at your fingertips
|
Public Attributes | |
errors | |
Data-driven visitor which walks the AST for some code and makes sure it doesn't contain any expression/statements which are declared as restricted in 'unallowed_ast_nodes'. We'll also make sure that there aren't any attempts to access/lookup restricted builtin declared in 'unallowed_builtins'. By default we also won't allow access to lowlevel stuff which can be used to dynamically access non-local envrioments. Interface: walk(ast) = validate AST and return True if AST is 'safe' Attributes: errors = list of SafeEvalError if walk() returned False Implementation: The visitor will automatically generate methods for all of the available AST node types and redirect them to self.ok or self.fail reflecting the configuration in 'unallowed_ast_nodes'. While walking the AST we simply forward the validating step to each of node callbacks which take care of reporting errors.