Changeset 2646 for package_branches/invirt-web
- Timestamp:
- Dec 19, 2009, 10:00:10 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
package_branches/invirt-web/cherrypy/code/view.py
r2645 r2646 14 14 """Callable which processes a dictionary, returning the rendered body.""" 15 15 16 def __init__(self, template, next_handler, content_type='text/html; charset=utf-8'): 16 def __init__(self, template, next_handler, 17 content_type='text/html; charset=utf-8'): 17 18 self.template = template 18 19 self.next_handler = next_handler … … 52 53 collection_size=-1, content_type='text/html; charset=utf-8', 53 54 imports=[]): 54 cherrypy.request.lookup = lookup = self.get_lookup( directories, module_directory,55 55 cherrypy.request.lookup = lookup = self.get_lookup( 56 directories, module_directory, collection_size, imports) 56 57 cherrypy.request.template = t = lookup.get_template(filename) 57 cherrypy.request.handler = MakoHandler(t, cherrypy.request.handler, content_type) 58 cherrypy.request.handler = MakoHandler( 59 t, cherrypy.request.handler, content_type) 58 60 59 61 cherrypy.tools.mako = cherrypy.Tool('on_start_resource', MakoLoader()) … … 102 104 response.body = JSONEncoder().iterencode(response.body) 103 105 104 cherrypy.tools.jsonify = cherrypy.Tool('before_finalize', jsonify_tool_callback, priority=30) 106 cherrypy.tools.jsonify = cherrypy.Tool('before_finalize', 107 jsonify_tool_callback, priority=30) 105 108 106 109 … … 111 114 "You are not authorized to access that resource") 112 115 113 cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', require_login, priority=150) 116 cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', 117 require_login, priority=150) 114 118 115 119 … … 120 124 "You must submit this request with POST") 121 125 122 cherrypy.tools.require_POST = cherrypy.Tool('on_start_resource', require_POST, priority=150) 126 cherrypy.tools.require_POST = cherrypy.Tool('on_start_resource', 127 require_POST, priority=150) 123 128 124 129 … … 146 151 cherrypy.request.login = user 147 152 148 cherrypy.tools.remote_user_login = cherrypy.Tool('on_start_resource', remote_user_login, priority=50) 153 cherrypy.tools.remote_user_login = cherrypy.Tool('on_start_resource', 154 remote_user_login, priority=50) 149 155 150 156 … … 154 160 cherrypy.request.state = State(cherrypy.request.login) 155 161 156 cherrypy.tools.invirtwebstate = cherrypy.Tool('on_start_resource', invirtwebstate_init, priority=100) 162 cherrypy.tools.invirtwebstate = cherrypy.Tool('on_start_resource', 163 invirtwebstate_init, priority=100) 157 164 158 165 159 166 class View(object): 160 _cp_config = {'tools.mako.directories': [os.path.join(os.path.dirname(__file__),'templates')]} 167 _cp_config = {'tools.mako.directories': 168 [os.path.join(os.path.dirname(__file__),'templates')]}
Note: See TracChangeset
for help on using the changeset viewer.