That didn't seem to quite do it.  Visiting http://domain.com/ rewrites
to http://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.

-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 visit http://domain.com/ I receive the 'invalid function' page
>> instead of rewriting to http://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

Reply via email to