Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance python_script to support "_getitem_" #8541

Merged
merged 3 commits into from
Jul 20, 2017

Conversation

sdague
Copy link
Contributor

@sdague sdague commented Jul 18, 2017

In order to use dict / list structures in python scripts we need
getitem allowed in the RestrictedPython environment. There is a
default_guarded_getitem included with RestrictedPython, which is a
pass through used in the Eval code paths.

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

In order to use dict / list structures in python scripts we need
_getitem_ allowed in the RestrictedPython environment. There is a
default_guarded_getitem included with RestrictedPython, which is a
pass through used in the Eval code paths.
@mention-bot
Copy link

@sdague, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob and @open-homeautomation to be potential reviewers.

@sdague
Copy link
Contributor Author

sdague commented Jul 18, 2017

putting this up for consideration for folks that understand RestrictedPython better to make sure this is safe.

@sdague sdague requested a review from balloob July 19, 2017 20:06
Copy link
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was already allowed. Oh well, this is fine with me.

@balloob balloob merged commit 8d1999d into home-assistant:dev Jul 20, 2017
@balloob balloob mentioned this pull request Jul 29, 2017
dethpickle pushed a commit to dethpickle/home-assistant that referenced this pull request Aug 18, 2017
* Enhance python_script to support "_getitem_"

In order to use dict / list structures in python scripts we need
_getitem_ allowed in the RestrictedPython environment. There is a
default_guarded_getitem included with RestrictedPython, which is a
pass through used in the Eval code paths.

* Add tests for dict/list support in python_scripts

* Lint
@home-assistant home-assistant locked and limited conversation to collaborators Oct 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants