Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 261

Show
Ignore:
Timestamp:
06/09/05 19:00:23
Author:
fumanchu
Message:

New lib/profiler module + catching up to trunk.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/ticket-177/cherrypy/_cpserver.py

    r243 r261  
    3535import time 
    3636import sys 
    37 import cpg, _cputil, _cphttptools, _cpthreadinglocal 
    38 from lib import autoreload 
     37import cpg, _cputil, _cphttptools 
     38 
     39try: 
     40    from threading import local 
     41except ImportError: 
     42    from _cpthreadinglocal import local 
     43 
     44 
     45from lib import autoreload, profiler 
    3946 
    4047 
     
    6673    # Create request and response object (the same objects will be used 
    6774    #   throughout the entire life of the webserver) 
    68     cpg.request = _cpthreadinglocal.local() 
    69     cpg.response = _cpthreadinglocal.local() 
     75    cpg.request = local() 
     76    cpg.response = local() 
    7077     
    7178    # Create threadData object as a thread-specific all-purpose storage 
    72     cpg.threadData = _cpthreadinglocal.local() 
     79    cpg.threadData = local() 
    7380     
    7481    # Output config options (if cpg.config.get('server.logToScreen')) 
     
    93100    for func in cpg.server.onStartServerList: 
    94101        func() 
     102     
     103    # Set up the profiler if requested. 
     104    if cpg.config.get("profiling.on", False): 
     105        ppath = cpg.config.get("profiling.path", "") 
     106        cpg.profiler = profiler.Profiler(ppath) 
     107    else: 
     108        cpg.profiler = None 
    95109     
    96110    if not initOnly: 
     
    169183        for func in cpg.server.onStartThreadList: 
    170184            func(i) 
    171     return _cphttptools.Request(clientAddress, remoteHost, 
    172                                 requestLine, headers, rfile) 
     185     
     186    if cpg.profiler: 
     187        cpg.profiler.run(_cphttptools.Request, clientAddress, remoteHost, 
     188                                               requestLine, headers, rfile) 
     189    else: 
     190        _cphttptools.Request(clientAddress, remoteHost, 
     191                             requestLine, headers, rfile) 
    173192 
    174193def stop(): 
  • branches/ticket-177/cherrypy/lib/filter/sessionfilter.py

    r251 r261  
    8989 
    9090def generateSessionId(): 
    91     s = ''.join([random.choice(alphanum) for i in xrange(50)]) 
    92     s += '%s' % time.time() 
     91    s = "%s_%s" % (str(random.random()) , str(time.time())) 
    9392    return sha.sha(s).hexdigest() 
    9493 
  • branches/ticket-177/cherrypy/test/test.py

    r256 r261  
    157157                   'server.socketQueueSize': 5, 
    158158                   'server.logToScreen': False, 
     159##                   'profiling.on': True, 
    159160                   } 
    160161     

Hosted by WebFaction

Log in as guest/cpguest to create tickets