On Nov 8, 2007 3:17 PM, Randy Pearson <[EMAIL PROTECTED]> wrote: > Hi. First time caller. We're studying WSGI and Pylons as a likely > environment to which to port existing applications and framework. In our > current environment, we often have 2 or more applications running under a > single process, where an "app manager" object sequentially offers the > request to each application, until one claims and handles it. > > There is an existing WSGI middleware piece named Cascade that appears to > work similarly, and could be a candidate approach; however, it uses 404 > responses from the applications as its signal to keep looking. In our > design, 404 responses have a different meaning: that the application has > accepted the URL pattern as being its own, and is deliberately stating that > a specific document or resource is not found. Thus we would specifically not > want to pass the request on to other apps when a 404 is returned. > > Is this "404 messaging" approach really needed? Or more specifically, does a > WSGI application need to respond at all? Maybe instead it simply never calls > the start_response callable and just returns None. If the app manager could > then examine whether start_response was called, and use that information to > decide whether to pass on to the next app. (If no app starts a response, the > app manager then issues the 404.)
You don't have to use Cascade. It exists only because people want to overlay controllers and static files in the same URL space, rather than having a /static URL for all static files or setting up a StaticFileController for each one. You could have the apps raise a certain exception if they don't want to handle the request, and make an alternate cascader that expects this. Assuming you want static files and Javascripts too, you'd probably want to put this "under" Cascade rather than replacing it, so that a 404 means your whole set of apps declined the request so now we should look for a static file. However, if the first URL component doesn't overlap between the aps, it would make more sense to use something like Paste composite to mount them at different URL points. You could also use Routes to direct them to different "controllers" which are realiy WSGI apps. 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. -- 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 -~----------~----~----~----~------~----~------~--~---
