> No, the "wrapper" would be a callable object, and it can be defined >> anywhere. wsgihandler.py is just the entry point -- you could import the >> wrapper in wsgihandler.py and then expose it to the web server (as in the >> built-in version of wsgihandler.py). >> > > OK, this is different from what I first understood. In other words, the > wrapper is gluon.main.wsgibase (but we can rename it in wsgihandler.py). >
Not quite sure what you mean. gluon.main.wsgibase is the web2py WSGI application, which ultimately executes your web2py application (so, I suppose in that sense, it wraps your application). However, if you want to implement WSGI middleware, then you must create another "wrapper" (i.e., another WSGI callable), and use that to wrap gluon.main.wsgibase. There is already an example of this in wsgihandler.py -- when logging is enabled, it uses gluon.main.appfactory to create a wrapper for gluon.main.wsgibase. > In fact, I was thinking that we would allow different wrappers for > different requests, associated with different applications. So, > gluon.main.wsgibase (what is exposed in wsgihandler.py) would not be the > wrapper, but would only map the requests to different wrappers. > Again, we can't use gluon.main.wsgibase because it is pre-existing code (we don't want to edit it) -- we have to wrap it with our own wrapper. Of course, our wrapper can be a complex program with multiple modules, etc., so we can do different things for different applications (i.e., run different pre/post-processing steps depending on the route requested). Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.