Commits

Sylvain Hellegouarch  committed 2c52847

Fixed #641

  • Participants
  • Parent commits 30b671e

Comments (0)

Files changed (2)

File cherrypy/_cpdispatch.py

             action = result.get('action', None)
             if action is not None:
                 handler = getattr(controller, action)
-        
+                # Get config from the handler 
+                if hasattr(handler, "_cp_config"): 
+                    merge(handler._cp_config)
+                    
         # Do the last path atom here so it can
         # override the controller's _cp_config.
         if last:

File cherrypy/test/test_routes.py

         
         def index(self, **kwargs):
             return "Welcome to %s, pop. %s" % (self.name, self.population)
+        index._cp_config = {'tools.response_headers.on': True,
+                            'tools.response_headers.headers': [('Content-Language', 'en-GB')]}
         
         def update(self, **kwargs):
             self.population = kwargs['pop']
             return "OK"
-    
+        
     d = cherrypy.dispatch.RoutesDispatcher()
     d.connect(name='hounslow', route='hounslow', controller=City('Hounslow'))
     d.connect(name='surbiton', route='surbiton', controller=City('Surbiton'),
         self.assertBody("OK")
         self.getPage("/surbiton")
         self.assertStatus("200 OK")
+        self.assertHeader("Content-Language", "en-GB")
         self.assertBody("Welcome to Surbiton, pop. 1327")
 
-
 if __name__ == '__main__':
     setup_server()
     helper.testmain()