Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Ticket #4: #4.patch

  • Tutorial/tutorial07.py

    old new  
    3232    index = cpg.expose(index) 
    3333 
    3434 
    35     def default(self): 
     35    def default(self, person): 
    3636        # Here we react depending on the virtualPath -- the part of the 
    3737        # path that could not be mapped to an object method. In a real 
    3838        # application, we would probably do some database lookups here 
    3939        # instead of the silly if/elif/else construct. 
    40         if cpg.request.virtualPath == 'remi': 
     40        if person == 'remi': 
    4141            out = "Remi Delon, CherryPy lead developer" 
    42         elif cpg.request.virtualPath == 'hendrik': 
     42        elif person == 'hendrik': 
    4343            out = "Hendrik Mans, CherryPy co-developer & crazy German" 
    44         elif cpg.request.virtualPath == 'lorenzo': 
     44        elif person == 'lorenzo': 
    4545            out = "Lorenzo Lamas, famous actor and singer!" 
    4646        else: 
    4747            out = "Unknown user. :-(" 
  • CherryPy/_cpHTTPTools.py

    old new  
    416416 
    417417        cpg.request.objectPath = myPath 
    418418        cpg.request.virtualPath = cpg.request.path[len(myPath)-1:] 
    419         cpg.response.body = func(**(cpg.request.paramMap)) 
     419        cpg.response.body = func(*(cpg.request.virtualPath.split('/')), **(cpg.request.paramMap)) 
    420420 
    421421    _cpUtil.getSpecialFunction('_cpInitResponse')() 
    422422 

Hosted by WebFaction

Log in as guest/cpguest to create tickets