Changeset 2399


Ignore:
Timestamp:
Aug 9, 2009, 6:45:28 PM (15 years ago)
Author:
quentin
Message:

Initialize state object correctly

Location:
package_branches/invirt-web/cherrypy/code
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • package_branches/invirt-web/cherrypy/code/main.fcgi

    r2387 r2399  
    2020    app = cherrypy.tree.mount(InvirtWeb(),
    2121        '/' if dev else '/main.fcgi',
    22         {'/':      {'tools.staticdir.root': static_dir},
     22        {'/':      {'tools.staticdir.root': static_dir,
     23                    'tools.invirtwebstate.on': True},
    2324        '/static': {'tools.staticdir.on': True,
    2425                    'tools.staticdir.dir': static_dir}
  • package_branches/invirt-web/cherrypy/code/view.py

    r2397 r2399  
    77import datetime, decimal
    88from invirt.config import structs as config
     9from webcommon import State
    910
    1011class MakoHandler(cherrypy.dispatch.LateParamPageHandler):
     
    100101cherrypy.tools.remote_user_login = cherrypy.Tool('on_start_resource', remote_user_login, priority=50)
    101102
     103def invirtwebstate_init():
     104    """Initialize the cherrypy.request.state object from Invirt"""
     105    cherrypy.request.state = State(cherrypy.request.login)
     106
     107cherrypy.tools.invirtwebstate = cherrypy.Tool('on_start_resource', invirtwebstate_init, priority=100)
     108
    102109class View(object):
    103110    _cp_config = {'tools.mako.directories': [os.path.join(os.path.dirname(__file__),'templates')]}
Note: See TracChangeset for help on using the changeset viewer.