Changeset 2723


Ignore:
Timestamp:
Dec 20, 2009, 9:47:40 PM (15 years ago)
Author:
broder
Message:

view.py: double blank lines at toplevel

This is a style convention that makes it easier to see where one
definition ends and the next begins. It's particularly necessary
in this file, because it can separate the CherryPy? glue associated
with one function from the unrelated function below it.

File:
1 edited

Legend:

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

    r2722 r2723  
    99from invirt.config import structs as config
    1010from webcommon import State
     11
    1112
    1213class MakoHandler(cherrypy.dispatch.LateParamPageHandler):
     
    5859cherrypy.tools.mako = cherrypy.Tool('on_start_resource', MakoLoader())
    5960
     61
    6062def revertStandardError():
    6163    """Move stderr to stdout, and return the contents of the old stderr."""
     
    6668    errio.seek(0)
    6769    return errio.read()
     70
    6871
    6972def catchStderr():
     
    8285cherrypy.tools.catch_stderr = cherrypy.Tool('before_handler', catchStderr)
    8386
     87
    8488class JSONEncoder(simplejson.JSONEncoder):
    8589        def default(self, obj):
     
    9195                        return simplejson.JSONEncoder.default(self, obj)
    9296
     97
    9398def jsonify_tool_callback(*args, **kwargs):
    9499    if not cherrypy.request.cached:
     
    98103
    99104cherrypy.tools.jsonify = cherrypy.Tool('before_finalize', jsonify_tool_callback, priority=30)
     105
    100106
    101107def require_login():
     
    107113cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', require_login, priority=150)
    108114
     115
    109116def require_POST():
    110117    """If the request isn't a POST request, raise 405 Method Not Allowed"""
     
    114121
    115122cherrypy.tools.require_POST = cherrypy.Tool('on_start_resource', require_POST, priority=150)
     123
    116124
    117125def remote_user_login():
     
    140148cherrypy.tools.remote_user_login = cherrypy.Tool('on_start_resource', remote_user_login, priority=50)
    141149
     150
    142151def invirtwebstate_init():
    143152    """Initialize the cherrypy.request.state object from Invirt"""
     
    147156cherrypy.tools.invirtwebstate = cherrypy.Tool('on_start_resource', invirtwebstate_init, priority=100)
    148157
     158
    149159class View(object):
    150160    _cp_config = {'tools.mako.directories': [os.path.join(os.path.dirname(__file__),'templates')]}
Note: See TracChangeset for help on using the changeset viewer.