Changeset 5733

Show
Ignore:
Timestamp:
11/20/08 09:18:13 (2 months ago)
Author:
carndt
Message:

Apply patch for #2013 (add config option to set CatWalk session dir) with modifications

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/turbogears/qstemplates/quickstart/+package+/config/app.cfg_tmpl

    r5666 r5733  
    9090# Set internationalization 
    9191# i18n.run_template_filter = True 
     92 
     93# CatWalk session directory 
     94# You may need to set this to the path of a directory with write access for 
     95# your server, e.g. if you deploy behind mod-wsgi and you want to use CatWalk 
     96# mounted in your own controllers. 
     97# By default CatWalk stores its session data in the directory 'catwalk-session' 
     98# below your application's package directory or below the current directory. 
     99# The path may be absolute or relative to the current working directory of your 
     100# server. The directory will be created if it does not exist, so make sure it 
     101# either exists already or the server has write access in the parent directory 
     102# as well. Example: 
     103# catwalk.session_dir = "/absolute/path/to/catwalk-session-dir" 
     104# Default: 
     105# catwalk.session_dir = 'catwalk-session' 
    92106 
    93107#if $identity != 'none' 
  • branches/1.1/turbogears/toolbox/catwalk/__init__.py

    r4202 r5733  
    2626 
    2727import turbogears 
    28 from turbogears import expose, identity 
     28from turbogears import config, expose, identity 
    2929 
    3030 
     
    592592        """Return the path to the catwalk session pickle. 
    593593 
    594         Create a session directory if nescesary. 
    595  
    596         """ 
    597         catwalk_session_dir = os.path.join(turbogears.util.get_package_name() 
    598             or '', 'catwalk-session') 
     594        By default this is located in a directory named 'catwalk-session' 
     595        beneath your application's package directory or, if the package name 
     596        can not be determined, below the ccurrent directory. 
     597 
     598        The directory must be writable by the server and will be created if it 
     599        does not exist. You can specify a different directory if you set the 
     600        config setting 'catwalk.session_dir' to an absolute path. 
     601 
     602        """ 
     603        catwalk_session_dir = os.path.join(config.get('catwalk.session_dir', 
     604            turbogears.util.get_package_name() or os.curdir), 'catwalk-session') 
    599605        catwalk_session_dir = os.path.abspath(catwalk_session_dir) 
    600606        if not os.path.exists(catwalk_session_dir): 
    601607            try: 
    602608                os.mkdir(catwalk_session_dir) 
    603             except IOError, e: 
     609            except (IOError, OSError), e: 
    604610                msg = 'Fail to create session directory %s' % e 
    605611                raise cherrypy.HTTPRedirect(turbogears.url('error', msg=msg))