cubicweb/pyramid/config.py
branch3.26
changeset 12562 7bb677060ebd
parent 12432 2fcb53ee5178
child 12565 8ef162b039a0
child 12566 6b3523f81f42
equal deleted inserted replaced
12511:e312461d3200 12562:7bb677060ebd
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """Configuration for CubicWeb instances on top of a Pyramid application"""
    18 """Configuration for CubicWeb instances on top of a Pyramid application"""
    19 
    19 
    20 from os import path
    20 from os import path
       
    21 import hashlib
       
    22 import time
    21 import random
    23 import random
    22 import string
    24 import string
    23 
    25 
    24 from logilab.common.configuration import merge_options
    26 from logilab.common.configuration import merge_options
    25 
    27 
    30 
    32 
    31 
    33 
    32 def get_random_secret_key():
    34 def get_random_secret_key():
    33     """Return 50-character secret string"""
    35     """Return 50-character secret string"""
    34     chars = string.ascii_letters + string.digits
    36     chars = string.ascii_letters + string.digits
    35     return "".join([random.choice(chars) for i in range(50)])
    37     secure_random = random.SystemRandom()
       
    38 
       
    39     return "".join([secure_random.choice(chars) for i in range(50)])
    36 
    40 
    37 
    41 
    38 class CubicWebPyramidConfiguration(BaseWebConfiguration, ServerConfiguration):
    42 class CubicWebPyramidConfiguration(BaseWebConfiguration, ServerConfiguration):
    39     """Pyramid application with a CubicWeb repository"""
    43     """Pyramid application with a CubicWeb repository"""
    40     name = 'pyramid'
    44     name = 'pyramid'