Auto-append slash to URL when necessary
This should make people happy, if they notice..
This commit is contained in:
		
							parent
							
								
									ed252c6465
								
							
						
					
					
						commit
						86c667e1f1
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -56,6 +56,9 @@ class CommonView(View):
 | 
			
		|||
    project_title = "Tailbone"
 | 
			
		||||
    project_version = tailbone.__version__
 | 
			
		||||
 | 
			
		||||
    def notfound(self):
 | 
			
		||||
        return httpexceptions.HTTPNotFound()
 | 
			
		||||
    
 | 
			
		||||
    def home(self, mobile=False):
 | 
			
		||||
        """
 | 
			
		||||
        Home page view.
 | 
			
		||||
| 
						 | 
				
			
			@ -112,6 +115,9 @@ class CommonView(View):
 | 
			
		|||
    @classmethod
 | 
			
		||||
    def defaults(cls, config):
 | 
			
		||||
 | 
			
		||||
        # auto-correct URLs which require trailing slash
 | 
			
		||||
        config.add_notfound_view(cls, attr='notfound', append_slash=True)
 | 
			
		||||
 | 
			
		||||
        # home
 | 
			
		||||
        config.add_route('home', '/')
 | 
			
		||||
        config.add_view(cls, attr='home', route_name='home', renderer='/home.mako')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue