On Friday, June 22, 2012 1:15:01 AM UTC-4, Pinakee Biswas wrote:
>
> Hi Mike and Jonathan,
>
>
>
> Thanks for your prompt response.
>
>
>
> Is there any corresponding API in Pyramid for the following?:
>
>
>
> pylons.controllers.util.*forward*(*wsgi_app*)
>
> Forward the request to a WSGI application. Returns its response.
>
> *return* forward(FileApp('filename'))
>
>
>
I didn't use that API in Pylons, but I think you want to do something like:
class LegacyView(object):
""" Forwards requests to given WSGI app. """
def __init__(self, app):
self.app = app
def __call__(self, request):
return request.get_response(self.app)
I forward to a WSGI application when a route raises an HTTPNotFound (In
Pylons what would be abort(404)). In the project's __init__ I have:
pylonsapp= make_app(global_config, **app_settings) # this is to make a
Pylons WSGI Application
legacy_view = LegacyView(pylonsapp)
config.add_view(context='pyramid.exceptions.NotFound', view=legacy_view,
permission=NO_PERMISSION_REQUIRED)
Of course you could make a route and view like you normally would, but just
specify that LegacyView instance as the view parameter to add_view.
-- Jason
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/pylons-discuss/-/X3dm38HCoCIJ.
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.