Seems I missed this response....more comments below On Wed, Aug 12, 2009 at 8:49 PM, David Pollak<[email protected]> wrote: > > > On Mon, Aug 10, 2009 at 9:07 AM, Jeppe Nejsum Madsen <[email protected]> > wrote: >> >> David Pollak <[email protected]> writes: >> >> > (1) Don't use open_! unless you have a very, very, very good reason to >> > do >> > so. It defeats the purpose of Box. >> >> I'm aware of this. But in this situation, most Locs are protected, ie the >> user is always logged in, so the only alternatives I see are: >> >> 1) wrap the code in map or something similar which will then return >> Empty if no user is found. But this is dangerous, giving the user the >> impression that no data is found when in fact this is a coding error. > > User.currentUserId.map(... business logic here) openOr defaultValue
But the problem arise when there is no good default to apply. I.e. suppose the business logic was "list my items" where "my" depends on currentUser. If, for all intents and purposes, this list is only available to signed in users, it doesn't really make sense to show no list or some random user's list. [...] >> The question comes down to: Why is User.currentUserId Empty when >> findForParam is called? > > Because this method is called during the re-writing phase. > > I've updated Lift to make the session available during the re-writing phase > if there is a session (a new session will not be created) to deal with this > situation. As noted above, I missed this post earlier and went ahead to create an example showing the problem. When I didn't succeed to show the error, I scratched my head a few times and went back to my app to see if it failed. Lo and behold, it worked! Thanks for the fix, sorry for the late reply :-) /Jeppe --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
