This really needs to go on the wiki! gold! Cheers, Tim
On 4 Mar 2010, at 17:50, David Pollak wrote: > > > On Thu, Mar 4, 2010 at 9:27 AM, aw <anth...@whitford.com> wrote: > On Mar 4, 6:56 am, Naftoli Gugenheim <naftoli...@gmail.com> wrote: > > How about > > LiftRules.stripComments.default.set( () => !Req.isIE) > > etc.? > > This is where Lift's FactoryMaker shines. You can modify the behavior of > stripComments on a request-by-request basis. You can have a snippet called > from your default template that tests the request and does: > > LiftRules.stripComments.request.set(S.request.map(!_.isIE) openOr false) > > But, as you point out, that means that CometActors will not get the right > settings... so you can set the rule on a session-by-session basis: > > LiftRules.stripComments.request.set(S.request.map(!_.isIE) openOr false) > > If that's not enough, you could also do the following in Boot.scala: > > object shouldStripComments extends SessionVar(S.request.map(!_.isIE) openOr > false) > > S.addAround(List(new LoanWrapper { > def apply[T](f: => T): T = > LiftRules.stripComments.doWith(shouldStripComments.is)(f) > })) > > The above code wraps each request with access to the shouldStripComments > Session Variable. > > The above vomit of different options is more for the benefit of those that > are confused by FactoryMaker and why it seems so complex... it's because it > offers a ton of different flexibility. > > Thanks, > > David > > > Well, this doesn't quite work because I need a Req class instance, not > just the static object. > Also, to me, this determination is really at the Session level rather > than the Request level as I don't expect it to change. But of course > I don't have a Session.isIE field... What about Comet responses? I > have no Request in that scenario, but is it using the same code to > produce the xhtml? > > I see that the Factory trait has a session-specific Maker and a > request-specific Maker, but it is unclear to me how I can get that > context. I require more guidance. > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > > > > -- > Lift, the simply functional web framework http://liftweb.net > Beginning Scala http://www.apress.com/book/view/1430219890 > Follow me: http://twitter.com/dpp > Surf the harmonics > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.