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

Improvement: make Python datasource to use the RestrictedPython sandbox #404

Merged
merged 4 commits into from Apr 13, 2015
Merged

Conversation

erans
Copy link
Contributor

@erans erans commented Apr 13, 2015

Python datasource that uses RestrictedPython. Only modules listed in "allowedImportModules" (command separated) will be allowed to be imported and the code assume they are installed on the server running the actual code.

…"allowedImportModules" (command separated) will be allowed to be imported and the code assume they are installed on the server running the actual code.
@@ -28,6 +29,14 @@
TYPE_DATETIME = 'datetime'
TYPE_DATE = 'date'

SUPPORTED_COLUMN_TYPES = {
Copy link
Member

Choose a reason for hiding this comment

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

Why dict and not set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are strings, AFAIK, using a dict means the "in" operator will use a hash search instead of matching the strings. In this case I think a set is the same as a list (maybe a bit better because it might be sorted).

Copy link
Member

Choose a reason for hiding this comment

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

Interesting point, but does it really matter? Considering we're talking about 6 elements and rarely used function? I think the set variant will be easier to understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are the BDFL :-) will change it to a set.

@arikfr arikfr changed the title Python datasource that uses RestrictedPython. Only modules listed in "al... Improvement: make Python datasource to use the RestrictedPython sandbox Apr 13, 2015
arikfr added a commit that referenced this pull request Apr 13, 2015
Improvement: make Python datasource to use the RestrictedPython sandbox
@arikfr arikfr merged commit d0d4101 into getredash:master Apr 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants