On Sun, Jun 28, 2009 at 4:35 PM, Thomas G. Willis<[email protected]> wrote:
>
>
>
> On Jun 25, 7:29 pm, "Thomas G. Willis" <[email protected]> wrote:
>
>> > > Would  you mind elaborating? It seems it should work. Doesn't routes
>> > > just pick up the SCRIPT_NAME and PATH_INFO from environ? And isn't the
>> > > purpose of the above map.connect to set those 2 variables
>> > > appropriately? What's the magic I'm missing?
>>
>> > It should be OK.  'path_info' is a magic variable that sets the real
>> > SCRIPT_NAME and PATH_INFO to the subapplication, as well as setting
>> > the routing variable.
>>
>> > I wonder if you have the same controller_scan problem I mentioned in
>> > an earlier message today.  If so, instantiate your route map with a
>> > list of controller names you think should be valid, and see if that
>> > clears up the problem.
>>
>> >     def my_controllers():
>> >         return ["registration"]
>> >     map = routes.Mapper(controller_scan=my_controllers)
>>
>> > Also turn on full debug logging.  (Set the root logger to debug, or a
>> > logger for routes.middleware.)
>>
>> > I would think that a 404 indicates a routing problem.  A missing
>> > controller module would raise ImportError, and a malformed controller
>> > would raise something else.  Make sure you're in development mode.
>> > (In production mode, missing controllers are disguised as 404s I
>> > think.)
>>
>> > I hope that nested Pylons applications work because I want to split up
>> > one of my applications this summer.
>>
>> > Be sure to set full_stack=False in the myapp.middleware.make_app()
>> > call.  I think you may also want to adjust the 'if full_stack:' in the
>> > function because the default doesn't look quite right to me.  I think
>> > you want the outer app to handle sessions and errors but the inner app
>> > to have its own routing, no?
>>
>> > Because of the 'full_stack' argument, it may not be appropriate to
>> > instantiate the inner app via paste.deploy.  You may have better luck
>> > calling make_app directly, and creating the desired configuration
>> > variables in the pseudo-controller module.  That is, assuming you're
>> > not passing a lot of variables through from the top-level
>> > configuration.
>>
>> > You can also set the WSGI application to __controller__ rather than
>> > RegistrationController. Or you may want a custom __controller__
>> > function that instantiates the application with a particular
>> > configuration and returns it.
>>
>> > --
>> > Mike Orr <[email protected]>
>>
>> OK lots of stuff to learn and try thanks for the suggestions. If I
>> figure out anything I'll share.
>
> OK, I think i've gotten to the bottom of the cause of the 404 but I
> don't know what the solution is.
>
> Basically, the contained app is looking in the container app for the
> controller to dispatch to, and doesn't find it and a 404 bubbles up. I
> suppose this is would be an issue with all paths that get set in
> load_environment. Is there a pylons dev around willing to shine some
> light on this?

The inner application is trying to find the controller in the outer
app's controller path?  They should have two separate 'config's, I
would think.  You're getting into the rare case where two Pylons apps
are sharing the same process.  The globals (pylons.config, etc) are
StackedObjectProxies for just this reason, so that each application
can push the correct objects onto the globals while it's active.
Perhaps this isn't working right.  Since you can't get to a
controller, the only place to test this definitively would be to put
logging statements in pylons.wsgiapp.PylonsApp.find_controller().  You
could put something like this in:

'import pprint
from pylons import config
log.debug("configuration is %s", pprint.pformat(config._current_obj()))

And look for any differences that would prove which configuration or
paths it's using.  Be sure to set the root logger to DEBUG in
development.ini; otherwise it won't show.

-- 
Mike Orr <[email protected]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to