0.10 at the moment, reckon i should upgrade to 0.11? This site is
going live soon though and I was not sure
about the status of 0.11-snapshot.

On Feb 4, 12:56 am, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> Crud.  It looks like the session cleanup is done outside of the session
> scope.
> Are you using 0.11-SNAPSHOT?
>
>
>
> On Tue, Feb 3, 2009 at 4:35 PM, Alli <allilis...@gmail.com> wrote:
>
> > Been testing this stuff and my object is like this:
>
> > object ReportAddress extends SessionVar[String]("") {
> >   def cleanUp() = {
> >    println(S.session)
> >    S.session.map { sess =>
> >      println("Session ID: " + sess.uniqueId)
> >      println("REM ADDRESS: " + this.is)
> >      val tempDir = ...
> >      // Remove the temporary dir for this session.
> >      tempDir.destroy()
> >    }
> >  }
>
> >  registerCleanupFunc(cleanUp _)
> > }
>
> > println(S.session) always gives me "Empty"
>
> > Any idea what could cause this?
>
> > On Feb 3, 10:38 pm, David Pollak <feeder.of.the.be...@gmail.com>
> > wrote:
> > > On Tue, Feb 3, 2009 at 2:13 PM, Alli <allilis...@gmail.com> wrote:
>
> > > > Makes a lot of sense, thanks David.
>
> > > > Always amazes me how good and clean the design of lift is.
>
> > > Flattery will get you a lot... :-)
>
> > > > On Feb 3, 9:49 pm, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> > > > > On Tue, Feb 3, 2009 at 1:06 PM, Alli <allilis...@gmail.com> wrote:
>
> > > > > > Evening,
>
> > > > > > During the lifetime of a session, the session may have uploaded
> > bunch
> > > > > > of files and these need to be able to be destroyed/unlinked when a
> > > > > > session ends.
>
> > > > > > When user uploads a file it's parent dir is determined by the
> > session
> > > > > > unique ID and the remote address of the uploader. The name is e.g.
> > /
> > > > > > tmp/sha1 hash of session id and remote address'.  This means in
> > order
> > > > > > to determine what to destroy I need to know what remote address the
> > > > > > session belongs to. I am setting that when uploading a file has
> > been
> > > > > > uploaded successfully.
>
> > > > > > In Boot.scala I want to do something like:
> > > > > >  // Set session handler.
> > > > > >    LiftSession.onAboutToShutdownSession = List[LiftSession =>
> > Unit](
> > > > > >        session => {
> > > > > >          var sessId = session.uniqueId
> > > > > >          val remoteIp = session.get("remoteAddress")
> > > > > >          val myTempDir = new TempDirWeb(sessId, remoteIp)
> > > > > >          myTempDir.unlinkall()
> > > > > >        })
>
> > > > > > Problem with this is that the LiftSession.get[T]() method is
> > package
> > > > > > private (liftweb). I can think of some other scenarios where one
> > would
> > > > > > need access to the session variables before destroying the session.
>
> > > > > > Does this make sense or is my design just plain wrong? :).
>
> > > > > get is typesafe, so exposing it would make it not type safe.  It's
> > always
> > > > > accessed via SessionVars.
>
> > > > > You can do something like:
>
> > > > > object ReportAddress extends SessionVar[String]("") {
> > > > >   def cleanUp() {
> > > > >     S.session.map{ sess =>
> > > > >     val td = new TempDirWeb(sess.uniqueId, this.is)
> > > > >     td.unlinkall()
> > > > >     }
> > > > >   }
>
> > > > >   registerCleanupFunc(cleanUp _)
>
> > > > > }
>
> > > > > Each SessionVar (and RequestVar) has a cleanup func that will be
> > called
> > > > as
> > > > > the Var is going away.
>
> > > > > > Cheers,
> > > > > > Alfred
>
> > > > > --
> > > > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > > > Follow me:http://twitter.com/dpp
> > > > > Git some:http://github.com/dpp
>
> > > --
> > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > Follow me:http://twitter.com/dpp
> > > Git some:http://github.com/dpp
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Git some:http://github.com/dpp
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to