On Nov 11, 2007 12:33 AM, Mike Orr <[EMAIL PROTECTED]> wrote:
> On Nov 10, 2007 7:10 AM, Randy Pearson <[EMAIL PROTECTED]> wrote:

> > >> Mike: But if you start thinking about "Python apps inside a Python app",
> > >> that's something that's just starting to be discussed.  The thread
> > >> "Sites within sites" two weeks ago has more info.  Basically we've
> > >> come up with a couple strategies that might work but nobody has tested
> > >> them yet.
> >
> > This is interesting and, oddly, it feels good that the discussion is just
> > getting started. Apps within apps, at least in WSGI space, could be
> > workable. Maybe a framework could provide general support for an app
> > containing sub-apps. When an app gets called, it gives its children (if any)
> > each a shot (like Cascade) and if none of them act, the parent takes its
> > shot. Just musing.

I guess those are the three ways to handle subapps:

1) paste.urlmap.UrlMap middleware dispatches to WSGI applications
based on URL prefix.

2) Cascade, patched to respond to a NotMyRequest exception, can go
through a list of applications until one works.

3) The subapp can masquerade as a Pylons controller.

Perhaps we can devise a PylonsComponent template for Paste.  However,
I'm still not sure what it would contain other than some trivial
changes to middleware.py (disable some middleware).  One feature might
be to read a different section in the config file.  Paste has the
concept of [app:main] and [app:otherapp], which I don't think Pylons
is using.  You may have to call the config-parsing function yourself
and pass the dict to the app constructor.

As far as the parent taking a shot, that may be too
application-specific to offer generic code for.  In my case, the only
thing outside the components is a home page with links to the
components.  Plus the login pages, images, and stylesheets, of course.

One issue is the site template.  If you design your apps as "site
template --> component template --> page template", you'll run into
trouble because Pylons is not set up to allow template inheritance
across application boundaries.

One way would be for the app to return just the page content, and the
parent app to plug it into the site template, kind of like middleware.
 However, my site templates depend on 'c' variables (title,
breadcrumbs, printable, etc).  Should we share 'c' between the parent
app and the child app?  Or the action could put the title etc in WSGI
variables, but it's cumbersome to access the WSGI environment in a
Pylons controller.  Ideally you'd want the subapp to be runnable
standalone too, which means it should output complete HTML pages using
a dummy site template.  Genshi/Kid would have an advantage here since
they could use a "match" template to insert a content tag into a site
template, extract the title, etc.  Mako/Cheetah would need comment
markers to know where the page content begins and ends.
Alternatively, one could put the site template in a shared package and
let the subapps apply it themselves.  But Buffet and Pylons "paths"
aren't really set up for having paths outside the application,
especially if the directory prefix will be different on each computer.

-- 
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