Ignore:
Timestamp:
Dec 20, 2009, 9:43:59 PM (14 years ago)
Author:
broder
Message:

Add list method, require authentication for it, and add a hello world via mako

File:
1 edited

Legend:

Unmodified
Added
Removed
  • package_branches/invirt-web/cherrypy-rebased/code/view.py

    r2659 r2665  
    6868cherrypy.tools.jsonify = cherrypy.Tool('before_finalize', jsonify_tool_callback, priority=30)
    6969
     70def external_remote_user_login():
     71    pass
     72
     73def require_login():
     74    """If the user isn't logged in, raise 403 with an error."""
     75    if cherrypy.request.login is False:
     76        raise cherrypy.HTTPError(403,
     77            "You are not authorized to access that resource")
     78
     79cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', require_login)
     80
    7081class View(object):
    7182    _cp_config = {'tools.mako.directories': [os.path.join(os.path.dirname(__file__),'templates')]}
Note: See TracChangeset for help on using the changeset viewer.