Actually, I had commented out routes_app altogether. When I restored it to this, things seemed to work again:
routes_app = ((r'/(?P<app>welcome|admin|examples|app)\b.*', r'\g<app>'), (r'(.*)', r'my_app'), (r'/?(.*)', r'my_app')) I was thinking that the logic would work as follows: 1. if base routes_in exists check URL against base routes_in (if match found then rewrite else continue) 2. if routes_app exists check URL against routes_app (if match found then load app-specific routes_in or app-specific default controller/ function else continue) 3. if default_app specified then load app-specific routes_in or app- specific default controller/function for the default_app 4. if no default_app specified and URL does not match base routes_in or routes_app return error Once URL rewriting has been redirected to a specific app (as in step 2 or 3 above) do the following: 1. if app-specific routes_in exists check URL against app-specific routes_in (if match found then rewrite else continue) 2. if URL maps to an existing controller/function, then call that controller/function else continue 3. if default_controller specified, prepend default_controller to URL and try step 2 else continue 4. if default_controller and default_function specified, prepend default_controller/default_function to URL and try step 2 else continue 5. if default_function specified, assume first part of URL is controller, insert default_function after assumed controller and before any potential function arguments 6. if nothing matches, return error Obviously my assumptions were not entirely correct. I'm wondering if you could pass along a brief overview of how the routes_app, default_app, default_controller, and default_function parameters all actually do interact in terms of URL rewriting. Thanks again, -Mike On Aug 31, 5:34 pm, Jonathan Lundell <jlund...@pobox.com> wrote: > On Aug 31, 2010, at 2:20 PM, Michael Wolfe wrote: > > > > > > > > > That didn't seem to quite do it. Visitinghttp://domain.com/rewrites > > tohttp://domain.com/my_app/default/index/instead of > >http://domain.com/my_app/default/search/. The URL is being > > substantively rewritten in the parse_url function (lines 802-807) of > > gluon/main.py: > > > request.application = \ > > regex_space.sub('_', match.group('a') or > > rewrite.params.default_application) > > request.controller = \ > > regex_space.sub('_', match.group('c') or > > rewrite.params.default_controller) > > request.function = \ > > regex_space.sub('_', match.group('f') or > > rewrite.params.default_function) > > > The problem being that rewrite.params.default_function is not using > > the default_function specified in my app-specific routes.py. > > > The parse_url function is being called from line 326 of gluon/main.py: > > > # ################################################## > > # invoke the legacy URL parser and serve static file > > # ################################################## > > > static_file = parse_url(request, environ) > > > To be clear, /my_app/default/search/ is not a static file; parse_url > > appears to do double-duty identifying static files and performing > > simple URL re-writes. > > > On a side note, I'll be heading home for the day soon and won't be > > working on this project again until Thursday. So if you don't get a > > response from me for awhile....that's why. > > OK. I'll take a closer look. It's helpful to know that it's getting 'index' > in this case. > > One final thing: what's your routes_app? Ishttp://domain.com/resulting in > my_app? Maybe you could send me, privately if you like, your global and > my_app routes.py. > > > > > > > -Mike > > > On Tue, Aug 31, 2010 at 4:09 PM, Jonathan Lundell <jlund...@pobox.com> > > wrote: > >> On Aug 31, 2010, at 12:53 PM, mwolfe02 wrote: > > >>> default_function does not seem to be recognized properly in app- > >>> specific routes.py. I'm thinking default_controller may have a > >>> similar problem, but I'm not really redefining it. > > >>> My base routes.py has default_application set to 'my_app' (and nothing > >>> set for default_controller or default_function). In the routes.py > >>> file for my 'my_app' I have the following set: > > >>> default_controller = 'default' # ordinarily set in app-specific > >>> routes.py > >>> default_function = 'search' # ordinarily set in app-specific > >>> routes.py > > >>> When I visithttp://domain.com/I receive the 'invalid function' page > >>> instead of rewriting tohttp://domain.com/my_app/default/search/. I'm > >>> debugging now and will post back when I learn more. > > >> OK, making the current app the default turned out to be pretty > >> straightforward, and even if that's not the problem you're having, I think > >> it makes sense to do. Here's the new rewrite.py: > > >>http://web.me.com/jlundell/filechute/rewrite.zip