From 0109b75d7c0780c56a7d0f66ec24ba37fd84c2f1 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Sat, 19 Dec 2009 22:00:10 -0500 Subject: [PATCH] view.py: fix long lines svn path=/package_branches/invirt-web/cherrypy-rebased/; revision=2724 --- code/view.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/code/view.py b/code/view.py index 1765ddf..9452cf0 100644 --- a/code/view.py +++ b/code/view.py @@ -13,7 +13,8 @@ from webcommon import State class MakoHandler(cherrypy.dispatch.LateParamPageHandler): """Callable which processes a dictionary, returning the rendered body.""" - def __init__(self, template, next_handler, content_type='text/html; charset=utf-8'): + def __init__(self, template, next_handler, + content_type='text/html; charset=utf-8'): self.template = template self.next_handler = next_handler self.content_type = content_type @@ -51,10 +52,11 @@ class MakoLoader(object): def __call__(self, filename, directories, module_directory=None, collection_size=-1, content_type='text/html; charset=utf-8', imports=[]): - cherrypy.request.lookup = lookup = self.get_lookup(directories, module_directory, - collection_size, imports) + cherrypy.request.lookup = lookup = self.get_lookup( + directories, module_directory, collection_size, imports) cherrypy.request.template = t = lookup.get_template(filename) - cherrypy.request.handler = MakoHandler(t, cherrypy.request.handler, content_type) + cherrypy.request.handler = MakoHandler( + t, cherrypy.request.handler, content_type) cherrypy.tools.mako = cherrypy.Tool('on_start_resource', MakoLoader()) @@ -101,7 +103,8 @@ def jsonify_tool_callback(*args, **kwargs): response.headers['Content-Type'] = 'text/javascript' response.body = JSONEncoder().iterencode(response.body) -cherrypy.tools.jsonify = cherrypy.Tool('before_finalize', jsonify_tool_callback, priority=30) +cherrypy.tools.jsonify = cherrypy.Tool('before_finalize', + jsonify_tool_callback, priority=30) def require_login(): @@ -110,7 +113,8 @@ def require_login(): raise cherrypy.HTTPError(403, "You are not authorized to access that resource") -cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', require_login, priority=150) +cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', + require_login, priority=150) def require_POST(): @@ -119,7 +123,8 @@ def require_POST(): raise cherrypy.HTTPError(405, "You must submit this request with POST") -cherrypy.tools.require_POST = cherrypy.Tool('on_start_resource', require_POST, priority=150) +cherrypy.tools.require_POST = cherrypy.Tool('on_start_resource', + require_POST, priority=150) def remote_user_login(): @@ -145,7 +150,8 @@ failed login, and is left at None if the user attempted no authentication. else: cherrypy.request.login = user -cherrypy.tools.remote_user_login = cherrypy.Tool('on_start_resource', remote_user_login, priority=50) +cherrypy.tools.remote_user_login = cherrypy.Tool('on_start_resource', + remote_user_login, priority=50) def invirtwebstate_init(): @@ -153,8 +159,10 @@ def invirtwebstate_init(): if not hasattr(cherrypy.request, "state"): cherrypy.request.state = State(cherrypy.request.login) -cherrypy.tools.invirtwebstate = cherrypy.Tool('on_start_resource', invirtwebstate_init, priority=100) +cherrypy.tools.invirtwebstate = cherrypy.Tool('on_start_resource', + invirtwebstate_init, priority=100) class View(object): - _cp_config = {'tools.mako.directories': [os.path.join(os.path.dirname(__file__),'templates')]} + _cp_config = {'tools.mako.directories': + [os.path.join(os.path.dirname(__file__),'templates')]} -- 1.7.9.5