Early access to S.location breaks snippet resolution

30 views
Skip to first unread message

David Whittaker

unread,
Jul 22, 2011, 1:52:20 PM7/22/11
to liftweb
I just ran into an issue where I was trying to log SQL events to a category using the class name of the Loc in use.  I found that when I implemented the feature any custom Loc implementation that contained a snippets method stopped working.  I've tracked it down to the S.location method itself where a RequestVar is used to store the current value.  It's lazily initialized to request.flatMap(_.location), so if the request or the location property within the request have not been initialized yet when the first access occurs the location is set to Empty and no other attempts are made.  It seems like Lift internally uses S.location further down the request processing chain to do Snippet resolution resulting in the issue I've seen.  Any thoughts on whether this is an issue worth addressing?  Should the S.location method attempt resolution more than once if the RequestVar is Empty?


David Pollak

unread,
Aug 16, 2011, 4:52:57 PM8/16/11
to lif...@googlegroups.com
On Fri, Jul 22, 2011 at 10:52 AM, David Whittaker <da...@iradix.com> wrote:
I just ran into an issue where I was trying to log SQL events to a category using the class name of the Loc in use.  I found that when I implemented the feature any custom Loc implementation that contained a snippets method stopped working.  I've tracked it down to the S.location method itself where a RequestVar is used to store the current value.  It's lazily initialized to request.flatMap(_.location), so if the request or the location property within the request have not been initialized yet when the first access occurs the location is set to Empty and no other attempts are made.  It seems like Lift internally uses S.location further down the request processing chain to do Snippet resolution resulting in the issue I've seen.  Any thoughts on whether this is an issue worth addressing?  Should the S.location method attempt resolution more than once if the RequestVar is Empty?

I'm game to make the change that allows for more frequent testing of the requestvar if it's empty.  Do you want to open a ticket on it and either assign it to you or assign it to me?
 


--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@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

David Whittaker

unread,
Aug 17, 2011, 1:55:00 PM8/17/11
to lif...@googlegroups.com
Hi David.  Welcome back.

I've created the ticket and assigned it to myself since it doesn't appear to be an issue for anyone else.  I set 2.5 as the milestone but I'm cautiously optimistic that my workload will settle down soon and it'll be done well before that.

-Dave
Reply all
Reply to author
Forward
0 new messages