Changeset 2391 for package_branches/invirt-web/cherrypy
- Timestamp:
- Aug 9, 2009, 6:45:23 PM (15 years ago)
- Location:
- package_branches/invirt-web/cherrypy/code
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
package_branches/invirt-web/cherrypy/code/main.py
r2390 r2391 52 52 super(self.__class__,self).__init__() 53 53 connect() 54 self._cp_config['tools.require_login.on'] = True 54 55 55 56 @cherrypy.expose 57 @cherrypy.tools.mako(filename="/list.mako") 58 def list(self, username): 59 """Handler for list requests.""" 60 checkpoint.checkpoint('Getting list dict') 61 d = getListDict(username, state) 62 checkpoint.checkpoint('Got list dict') 63 return templates.list(searchList=[d]) 64 index=list 65 66 @cherrypy.expose 67 @cherrypy.tools.mako(filename="/helloworld.mako") 56 68 def helloworld(self): 57 return "Hello world!" 69 return {} 70 return "Hello world!\nYour request: "+repr(dir(cherrypy.request)) 71 helloworld._cp_config['tools.require_login.on'] = False 58 72 59 73 def pathSplit(path): … … 229 243 return d 230 244 231 def listVms(username, state, path, fields):232 """Handler for list requests."""233 checkpoint.checkpoint('Getting list dict')234 d = getListDict(username, state)235 checkpoint.checkpoint('Got list dict')236 return templates.list(searchList=[d])237 238 245 def vnc(username, state, path, fields): 239 246 """VNC applet page. … … 638 645 raise RuntimeError("test of the emergency broadcast system") 639 646 640 mapping = dict( list=listVms,647 mapping = dict(#list=listVms, 641 648 vnc=vnc, 642 649 command=command, -
package_branches/invirt-web/cherrypy/code/view.py
r2385 r2391 68 68 cherrypy.tools.jsonify = cherrypy.Tool('before_finalize', jsonify_tool_callback, priority=30) 69 69 70 def external_remote_user_login(): 71 pass 72 73 def 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 79 cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', require_login) 80 70 81 class View(object): 71 82 _cp_config = {'tools.mako.directories': [os.path.join(os.path.dirname(__file__),'templates')]}
Note: See TracChangeset
for help on using the changeset viewer.