Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 39 additions & 49 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,52 +29,42 @@ def read(*rnames):
]


setup(name='RestrictedPython',
version='4.0b3.dev0',
url='http://pypi.python.org/pypi/RestrictedPython',
license='ZPL 2.1',
description='RestrictedPython is a defined subset of the Python '
'language which allows to provide a program input into '
'a trusted environment.',
long_description=(read('README.rst') + '\n' +
read('docs', 'CHANGES.rst')),
classifiers=[
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Security',
],
keywords='restricted execution security untrusted code',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
packages=find_packages('src'),
package_dir={'': 'src'},
install_requires=[
'setuptools',

],
setup_requires=[
'pytest-runner',
],
tests_require=tests_require,
extras_require={
'docs': [
'Sphinx',
],
'test': tests_require,
'release': [
'zest.releaser',
],
'develop': [
'pdbpp',
'isort',
],
},
include_package_data=True,
zip_safe=False,
)
setup(
name='RestrictedPython',
version='4.0b3.dev0',
url='http://pypi.python.org/pypi/RestrictedPython',
license='ZPL 2.1',
description='RestrictedPython is a defined subset of the Python '
'language which allows to provide a program input into '
'a trusted environment.',
long_description=(read('README.rst') + '\n' +
read('docs', 'CHANGES.rst')),
classifiers=[
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Security',
],
keywords='restricted execution security untrusted code',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
packages=find_packages('src'),
package_dir={'': 'src'},
install_requires=[
'setuptools',
],
setup_requires=[
'pytest-runner',
],
tests_require=tests_require,
extras_require={
'test': tests_require,
},
include_package_data=True,
zip_safe=False,
)
5 changes: 3 additions & 2 deletions src/RestrictedPython/Eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def prepUnrestrictedCode(self):
self.expr,
'<string>',
'eval',
ast.PyCF_ONLY_AST)
ast.PyCF_ONLY_AST,
)

co = compile(exp_node, '<string>', 'eval')

Expand All @@ -99,7 +100,7 @@ def eval(self, mapping):

global_scope = {
'_getattr_': default_guarded_getattr,
'_getitem_': default_guarded_getitem
'_getitem_': default_guarded_getitem,
}

global_scope.update(self.globals)
Expand Down
17 changes: 11 additions & 6 deletions src/RestrictedPython/Guards.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
'slice',
'str',
'tuple',
'zip'
'zip',
]

_safe_exceptions = [
Expand Down Expand Up @@ -207,19 +207,23 @@ def __init__(self, ob):

__setitem__ = _handler(
'__guarded_setitem__',
'object does not support item or slice assignment')
'object does not support item or slice assignment',
)

__delitem__ = _handler(
'__guarded_delitem__',
'object does not support item or slice assignment')
'object does not support item or slice assignment',
)

__setattr__ = _handler(
'__guarded_setattr__',
'attribute-less object (assign or del)')
'attribute-less object (assign or del)',
)

__delattr__ = _handler(
'__guarded_delattr__',
'attribute-less object (assign or del)')
'attribute-less object (assign or del)',
)
return Wrapper


Expand Down Expand Up @@ -265,7 +269,8 @@ def safer_getattr(object, name, getattr=getattr):
"""
if isinstance(object, _compat.basestring) and name == 'format':
raise NotImplementedError(
'Using format() on a %s is not safe.' % object.__class__.__name__)
'Using format() on a %s is not safe.' % object.__class__.__name__,
)
return getattr(object, name)


Expand Down
Loading