Ignore:
Timestamp:
Aug 9, 2009, 6:45:23 PM (15 years ago)
Author:
quentin
Message:

Add list method, require authentication for it, and add a hello world via mako

File:
1 edited

Legend:

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

    r2390 r2391  
    5252        super(self.__class__,self).__init__()
    5353        connect()
     54        self._cp_config['tools.require_login.on'] = True
    5455
    5556    @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")
    5668    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
    5872
    5973def pathSplit(path):
     
    229243    return d
    230244
    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 
    238245def vnc(username, state, path, fields):
    239246    """VNC applet page.
     
    638645    raise RuntimeError("test of the emergency broadcast system")
    639646
    640 mapping = dict(list=listVms,
     647mapping = dict(#list=listVms,
    641648               vnc=vnc,
    642649               command=command,
Note: See TracChangeset for help on using the changeset viewer.