Merge branch 'master' of github.com:web2py/web2py

This commit is contained in:
mdipierro
2017-03-20 16:15:31 -05:00
2 changed files with 15 additions and 13 deletions
+1 -1
View File
@@ -640,7 +640,7 @@ def run_controller_in(controller, function, environment):
ccode = getcfs(layer, filename, lambda: compile2(code, layer))
restricted(ccode, environment, layer=filename)
response = current.response
response = environment["response"]
vars = response._vars
if response.postprocessing:
vars = reduce(lambda vars, p: p(vars), response.postprocessing, vars)
+14 -12
View File
@@ -17,6 +17,7 @@ import random
import inspect
import time
import os
import sys
import re
import logging
import socket
@@ -299,19 +300,20 @@ def initialize_urandom():
try:
os.urandom(1)
have_urandom = True
try:
# try to add process-specific entropy
frandom = open('/dev/urandom', 'wb')
if sys.platform != 'win32':
try:
if PY2:
frandom.write(''.join(chr(t) for t in ctokens))
else:
frandom.write(bytes([]).join(bytes([t]) for t in ctokens))
finally:
frandom.close()
except IOError:
# works anyway
pass
# try to add process-specific entropy
frandom = open('/dev/urandom', 'wb')
try:
if PY2:
frandom.write(''.join(chr(t) for t in ctokens))
else:
frandom.write(bytes([]).join(bytes([t]) for t in ctokens))
finally:
frandom.close()
except IOError:
# works anyway
pass
except NotImplementedError:
have_urandom = False
logger.warning(