Skip to content

Commit

Permalink
Document the AST transformations in visit_Attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephan-hof committed Oct 5, 2016
1 parent 8e0bfee commit 82ff611
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/RestrictedPython/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,13 @@ def visit_IfExp(self, node):
return self.generic_visit(node)

def visit_Attribute(self, node):
"""Checks and mutates attribute access/assignment.
'a.b' becomes '_getattr_(a, "b")'
'a.b = c' becomes '_write_(a).b = c'
The _write_ function should return a security proxy.
"""
if node.attr.startswith('_') and node.attr != '_':
self.error(
node,
Expand Down

0 comments on commit 82ff611

Please sign in to comment.