On Mon, 2011-02-28 at 10:37 -0800, Mike Orr wrote: > On Sun, Feb 27, 2011 at 10:28 PM, Chris Withers <ch...@simplistix.co.uk> > wrote: > > On 26/02/2011 10:18, Wichert Akkerman wrote: > >> > >> We had a mini-discussion on this topic on irc this week. The only > >> difference between the two is that repoze.tm2 uses middleware, while > >> pyramid_tm uses pyramid events. > >> > >> Personally I am a bit worried about a trend to move away from reusable > >> WSGI middleware to pyramid-specific approaches, especially when there > >> appears to be no functional benefit. > > > > Indeed. Thanks for the clarification, I'll definitely stick with repoze.tm2 > > then. > > I haven't looked at pyramid_tm closely enough to tell whether it'll > work for pyramid_sqla, but the fact remains that WSGI is a clunky > protocol for services, and a non-middleware solution would be welcome. > The protocol is good for web servers and non-data services like error > handlers, but it forces a distortion in libraries that share data with > the application because you can't just call things directly, you have > to shoehorn the data into one dict or the HTTP headers, and any > interaction in views has to be via callback objects in the dict. It's > ironic that Jim Fulton used to complain that using middleware for data > services was an abuse of the protocol and framework/application > developers ignored him, but now after five years of use framework > developers are coming to the same conclusion for a different reason: > the WSGI protocol is just too artificial and rigid to use for data > services. You see that especially in repoze.who/what, which are overly > complex partly because of their middleware nature, and to an extent > Routes too. Generic reusable code is a good thing but it doesn't have > to be middleware. The various form libraries are reusable but they > aren't middleware.
I don't think there's a convenient generalization to apply here. repoze.tm2 vs. pyramid_tm is more about opinion than it is technology Both offer the same features and the same benefits, and neither has a particular downside that isn't rooted in pure opinion. On the other hand, there are cases where using middleware is clearly not the right thing; I've been asked many times for example "how do I get to the Pyramid registry from middleware I'm creating" and the answer is always "if you need to do that, what you're creating is not meant to be middleware". - C -- 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.