On Sun, Feb 27, 2011 at 2:15 PM, oO <oliv...@ozoux.com> wrote: > Sorry if this is a basic question, but as I'm starting to add more and > more layers of complexity to my first pyramid based applications, I'm > starting to wonder about some of the benefits of using pyramid > specific implementations as opposed to re-using the existing WSGI > plumbing (like I was doing with pylons) > > Sow what is the difference between installing beaker as a wsgi > middleware, vs using the pyramid_beaker package? > > Is it only that you end up accessing the session from request.session > instead of request.environ['beaker.session'] or are there other > advantages? >
When you use request.session you are using the session interface documented by Pyramid. You can use beaker, or the built-in session implementation, or you could write your own, without having to change your code. > There seems to be a trend in pyramid development of re-implementing a > lot of what was previously done in various layers of wsgi middleware > ( session, auth, ...) and moving those part inside the main > application layer. Is there a reason for this? > On the other hand, you probably aren't going to see gzip compression re-implemented as a Pyramid component. WSGI is not a convenient way to compose integrated applications. WSGI middleware lets you pretend your web server has a sessions feature, but the only integration point is an awkward 'stick something in environ' interface. I've tried using middleware to add a login form to my application, and then I tried implementing the login form in the application itself. It was awkward and frustrating to setup a system that handles requests at two layers of the call stack. It was much easier and smoother to just add the login form to my application. I think this is a strong sign that authentication is part of the application and belongs there. Let WSGI implement the Web Server. -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.