Changeset 2645 for package_branches/invirt-web/cherrypy/code
- Timestamp:
- Dec 19, 2009, 10:00:08 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
package_branches/invirt-web/cherrypy/code/view.py
r2644 r2645 9 9 from invirt.config import structs as config 10 10 from webcommon import State 11 11 12 12 13 class MakoHandler(cherrypy.dispatch.LateParamPageHandler): … … 58 59 cherrypy.tools.mako = cherrypy.Tool('on_start_resource', MakoLoader()) 59 60 61 60 62 def revertStandardError(): 61 63 """Move stderr to stdout, and return the contents of the old stderr.""" … … 66 68 errio.seek(0) 67 69 return errio.read() 70 68 71 69 72 def catchStderr(): … … 82 85 cherrypy.tools.catch_stderr = cherrypy.Tool('before_handler', catchStderr) 83 86 87 84 88 class JSONEncoder(simplejson.JSONEncoder): 85 89 def default(self, obj): … … 91 95 return simplejson.JSONEncoder.default(self, obj) 92 96 97 93 98 def jsonify_tool_callback(*args, **kwargs): 94 99 if not cherrypy.request.cached: … … 98 103 99 104 cherrypy.tools.jsonify = cherrypy.Tool('before_finalize', jsonify_tool_callback, priority=30) 105 100 106 101 107 def require_login(): … … 107 113 cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', require_login, priority=150) 108 114 115 109 116 def require_POST(): 110 117 """If the request isn't a POST request, raise 405 Method Not Allowed""" … … 114 121 115 122 cherrypy.tools.require_POST = cherrypy.Tool('on_start_resource', require_POST, priority=150) 123 116 124 117 125 def remote_user_login(): … … 140 148 cherrypy.tools.remote_user_login = cherrypy.Tool('on_start_resource', remote_user_login, priority=50) 141 149 150 142 151 def invirtwebstate_init(): 143 152 """Initialize the cherrypy.request.state object from Invirt""" … … 147 156 cherrypy.tools.invirtwebstate = cherrypy.Tool('on_start_resource', invirtwebstate_init, priority=100) 148 157 158 149 159 class View(object): 150 160 _cp_config = {'tools.mako.directories': [os.path.join(os.path.dirname(__file__),'templates')]}
Note: See TracChangeset
for help on using the changeset viewer.