As a quick fix you can just wrap your object in a function. def my_wsgi_app(environ, start_response): return MyWsgiObj(environ, start_response)
config.add_view(wsgiapp2(my_wsgi_app), name='jinja2js') On Mon, Dec 5, 2011 at 11:06 AM, Michael Kerrin <michael.ker...@gmail.com>wrote: > Yipe, thanks for that. pyramid.wsgi.wsgiapp2 works with a small tweak as > it doesn't support handling an object instance. > > I know that it is meant to be a decorator on a method but I don't want my > third party WSGI code to depend on pyramid so I am now trying to do the > following: > > wsgiapp = WSGIApp(app_config_settings) > config.add_view(pyramid.wsgi.wsgiapp2(wsgiapp), name = 'jinja2js') > > I get an attribute error, when the decorate tries to wrap the __name__ > attribute from my app. Which doesn't have a __name__ as it is an instance > of a class. I will add an issue for this. > > Thanks for the hint, > Michael > > > On 5 December 2011 16:30, Michael Merickel <mmeri...@gmail.com> wrote: > >> Does this help? Basically you can add a view that is actually a wsgi >> application. >> >> http://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/api/wsgi.html >> >> >> On Mon, Dec 5, 2011 at 6:57 AM, Michael Kerrin >> <michael.ker...@gmail.com>wrote: >> >>> Hi, >>> >>> I am starting to use Pyramid for a project and I want to integrate some >>> third party code of mine that has already been developed and provides a >>> WSGI application already. >>> >>> Ideally I want some code in my entry point to my Pyramid app that does >>> the following:: >>> >>> def main(global_config, **settings): >>> config = Configurator(...) >>> ... >>> mywsgiapp = WSGIApp(app_config_settings) >>> config.add_wsgi_app(mywsgiapp, name = "application_namespace") >>> ... >>> >>> My rational for this is that my application shares a lot of >>> configuration that is already defined for Pyramid that I can reuse. But I >>> also want to support other web frameworks, but with an minimal amount of >>> dependencies and options on my third party code. >>> >>> Pyramid views and WSGI applications implement two different apis, which >>> is fine but I would like to think (or explore the idea) that the WSGI >>> interface can be used as a gateway between frameworks as well as from >>> framework <-> server. >>> >>> So my question is has anyone looked into doing this? >>> >>> Thanks, >>> Michael >>> >>> -- >>> Blog: http://mkerrin.wordpress.com/ >>> Twitter: http://twitter.com/michael_kerrin >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "pylons-discuss" group. >>> To post to this group, send email to pylons-discuss@googlegroups.com. >>> To unsubscribe from this group, send email to >>> pylons-discuss+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://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 pylons-discuss@googlegroups.com. >> To unsubscribe from this group, send email to >> pylons-discuss+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/pylons-discuss?hl=en. >> > > > > -- > Blog: http://mkerrin.wordpress.com/ > Twitter: http://twitter.com/michael_kerrin > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To post to this group, send email to pylons-discuss@googlegroups.com. > To unsubscribe from this group, send email to > pylons-discuss+unsubscr...@googlegroups.com. > For more options, visit this group at > http://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 pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.