10 messages in com.googlegroups.pylons-discussRe: adding controllers to an existing...
FromSent OnAttachments
Jose Galvez23 Apr 2007 14:18 
Mayowa23 Apr 2007 23:15 
Jose Galvez24 Apr 2007 09:36 
Ben Bangert24 Apr 2007 10:41 
Ben Bangert25 Apr 2007 11:50 
Jose Galvez25 Apr 2007 11:55 
Jose Galvez25 Apr 2007 13:01 
Ben Bangert25 Apr 2007 13:17 
Jose Galvez25 Apr 2007 14:20 
Ben Bangert25 Apr 2007 18:44 
Subject:Re: adding controllers to an existing application
From:Ben Bangert (ben-@public.gmane.org)
Date:04/25/2007 11:50:49 AM
List:com.googlegroups.pylons-discuss

On Apr 24, 2007, at 9:37 AM, Jose Galvez wrote:

If I understand you correctly I should be able to add a new controller to a running pylons service (assuming there is a route to handle it) is that correct?, because that has not been my experience. When I've added a new controller I've always had to restart the service otherwise I get a 404 error

As I mentioned, you have to set the map attribute to false, to have Routes re-scan the controller dir and become aware of controllers. Then a generic route like: map.connect(':controller/:action/:id')

will recognize the new controller. This will work on a live system without a restart. To grab the mapper instance anywhere:

from routes import request_config

map = request_config().mapper map._created_regs = False

On the next request, :controller will be able to match the new controller.

Cheers, Ben