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

Changeset 268

Show
Ignore:
Timestamp:
06/10/05 17:20:43
Author:
mikerobi
Message:

created my experimental branch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/mikerobi-experimental/cherrypy/_cpconfig.py

    r267 r268  
    2424            'session.cookieName': 'CherryPySession', 
    2525            'session.storageFileDir': '', 
     26 
     27            'sessionFilter.on': True, 
     28            'sessionFilter.new': 'sessionMap', 
     29            'sessionFilter.timeout': 60, 
     30            'sessionFilter.storageType' : 'ram', 
     31            'sessionFilter.cookieName': 'CherryPySession', 
     32            'sessionFilter.storageFileDir': '.sessionFiles' 
    2633        }, 
    2734    } 
     
    4047        _load(file) 
    4148 
    42 def get(key, defaultValue=None, returnSection=False): 
     49def get(key, defaultValue=None, returnSection=False, startPath = None): 
    4350    # Look, ma, no Python function calls! Uber-fast. 
     51    # start path lest you overload the starting search path (needed by getAll) 
     52     
    4453    global cpg 
    4554    if not cpg: 
    4655        import cpg 
    4756     
    48     try: 
    49         path = cpg.request.path 
    50     except AttributeError: 
    51         path = "/" 
     57    if startPath: 
     58        path = startPath 
     59    else: 
     60        try: 
     61            path = cpg.request.path 
     62        except AttributeError: 
     63            path = "/" 
    5264     
    5365    while True: 
     
    7284    else: 
    7385        return result 
     86         
     87import os.path 
    7488 
     89def getAll(key): 
     90    """ 
     91    getAll will lookup the key in the current node and all of its parent nodes, 
     92    it will return a dictionary paths of each node containing the key and its value 
     93 
     94    This function is required by the session filter 
     95    """ 
     96    path = get(key, None, returnSection = True) 
     97    value = get(key) 
     98     
     99    result = {} 
     100    while value != None and path != '/': 
     101        result[path]= value 
     102        path = os.path.split(path)[0] 
     103        value = get(key, None, returnSection = False, startPath = path) 
     104        path  = get(key, None, returnSection = True, startPath = path) 
     105     
     106    if path == '/' and value != None: 
     107        result[path] = value 
     108     
     109    return result 
    75110class CaseSensitiveConfigParser(ConfigParser.ConfigParser): 
    76111    """ Sub-class of ConfigParser that keeps the case of options and 
  • branches/mikerobi-experimental/cherrypy/_cpdefaults.py

    r267 r268  
    170170from cherrypy.lib.filter import baseurlfilter, cachefilter, \ 
    171171    decodingfilter, encodingfilter, gzipfilter, logdebuginfofilter, \ 
    172     sessionfilter, staticfilter, nsgmlsfilter, tidyfilter, \ 
     172    staticfilter, nsgmlsfilter, tidyfilter, \ 
    173173    virtualhostfilter, xmlrpcfilter 
     174 
     175from cherrypy.lib.filter.sessionfilter import sessionfilter 
    174176 
    175177_cachefilter = cachefilter.CacheFilter() 
  • branches/mikerobi-experimental/cherrypy/test/test_tutorials.py

    r267 r268  
    149149         
    150150        helper.request('/') 
     151        test =open('test.mlog','w') 
     152        test.write(cpg.response.body) 
     153                   #      "\n            During your current session, you've viewed this" 
     154                   #      "\n            page 1 times! Your life is a patio of fun!" 
     155                   #      "\n        ")) 
     156        test.close() 
    151157        self.assertEqual(cpg.response.body, 
    152158                         "\n            During your current session, you've viewed this" 

Hosted by WebFaction

Log in as guest/cpguest to create tickets