
On Sat, Jan 22, 2011 at 8:34 PM, Matt Brown
That's basically it, but I'm not sure what you mean by "global site preparation." The idea here is to do as little as possible before dispatching to the subsite, that way if a subsite does not want to deal with sessions, it doesn't involve that overhead.
I just meant it as a way to enable middleware for all subsites at once. It should still be configurable though, so the author can switch to a per-subsite setup. For example, it may be appropriate for the scaffolder to enable sessions globally, and let the author switch to per-subsite if/when performance becomes a concern.
The basic approach I'm leaning towards is having a method in the Yesod typeclass (call it yesodRunner for now) which converts a Handler to an Application. This would be where middlewares are defined. We will keep the default behavior the same as in Yesod 0.6, but allow the ability to override this to provide a more slimmed-down experience. Then there will also be a yesodSubRunner method (I guess on YesodSubSite) which, by default, will use the yesodRunner method from the master site, but which can be overridden to allow custom behavior for subsites. This would be the control over customization in the hands of the subsite authors. The one downside I see is if there's a subsite which requires sessions, and a user turns off sessions for his/her master site, things will break. But I think that's an issue addressed best with proper documentation. Michael