Cool solution! Is there a way to access the app outside of middleware?
Would it make sense to add it to the environment so I can access it
from within a controller?

-Andres


On Oct 22, 10:09 am, Gael Pasgrimaud <[email protected]> wrote:
> On Fri, Oct 22, 2010 at 3:47 PM, andres <[email protected]> wrote:
> > Hi,
>
> > This is a bit difficult to explain... I need to make an app request
> > from within the app itself. The purpose is to allow for batch
> > processing of multiple http requests into one server call:
>
> > class MultiplerequestController(BaseController):
> >    def get_resources(self, resource_urls=None):
> >        responses = [self.app.get(resource_url) for resource_url in
> > resource_urls]
> >        return json.dumps(responses)
>
> > Is there a way to access the app instance from within the app itself?
> > Or, is there a better way to pass a url argument to the app from
> > inside the app?
>
> I think that the best way is to write a middleware for this:
>
> class Dispatcher(object):
>
>     def __init__(self, app):
>         self.app = app
>
>     def __call__(self, environ, start_response):
>         req = Request(environ)
>         for path in ('/1', '/2'):
>             req.path_info = path
>             resp = req.get_response(app)
>        return 'html'
>
>
>
>
>
>
>
> > Thanks,
>
> > Andres
>
> > --
> > 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 
> > athttp://groups.google.com/group/pylons-discuss?hl=en.

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