Commit 0972d806 authored by Jérome Perrin's avatar Jérome Perrin

patches/Restricted: allow random.SystemRandom

parent 110d9931
...@@ -344,3 +344,6 @@ for member_id in dir(decimal): ...@@ -344,3 +344,6 @@ for member_id in dir(decimal):
if isinstance(member, type) and issubclass(member, decimal.DecimalException): if isinstance(member, type) and issubclass(member, decimal.DecimalException):
ContainerAssertions[member] = 1 ContainerAssertions[member] = 1
del member_id, member del member_id, member
from random import SystemRandom
allow_type(SystemRandom)
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
# #
############################################################################## ##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.ERP5Type.tests.utils import removeZODBPythonScript from Products.ERP5Type.tests.utils import removeZODBPythonScript
...@@ -123,3 +121,7 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase): ...@@ -123,3 +121,7 @@ class TestRestrictedPythonSecurity(ERP5TypeTestCase):
'return urlparse.parse_qsl("q=s")', 'return urlparse.parse_qsl("q=s")',
expected=[('q', 's')] expected=[('q', 's')]
) )
def testSystemRandom(self):
self.createAndRunScript('import random',
'return random.SystemRandom().getrandbits(10)')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment