[albatross-users] SessionFileAppMixin has no session_age

Michael Barrett mike at daboyz.org
Tue Jan 28 19:07:22 EST 2003


I was actually looking for a way to make the sessions last longer.  Wouldn't it
just be a matter of turning up the expire time on the cookie?

I pretty much want to make it so that if someone logs into my site, and clicks
the 'remember me' button it does just that and lets them log in.  Say it keeps
the session for about a week.

Any reason why that wouldn't be possible?

On Tue, Jan 28, 2003 at 11:53:11AM +1100, Andrew McNamara wrote:
> >    Is there a technical reason why SessionFileAppMixin has no 'session_age'
> >    argument?  I see it in SessionServerApp, and I'd like to use it in the
> >    File version.  Just wondering if this has already been attempted and
> >    wasn't able to be easily done, or if it's just not being dealt with.
> 
> With the SessionServer sessions, you have a single session daemon, which
> can track sessions and clean out old ones, but with the SessionFile
> implementation, processes come and go, so I decided it should really be
> an external mechanism.
> 
> Under Unix, you would probably just have a cron job that cleaned out any
> files with a modification date older than some age. Something like this
> would remove sessions older than a day:
> 
>     find /some/session/dir -mtime +1 | xargs rm
> 
> What's probably needed is a python equivilent, something like (WARNING - 
> UNTESTED):
> 
>     import os, time
> 
>     def session_clean(dir, age):
>         """
>         Scan "dir" for files older than "age" seconds, and remove them
>         """
>         expire_time = time.time() - age
>         for filename in os.listdir(dir):
>             filepath = os.path.join(dir, filename)
>             if os.path.getmtime(filepath) < expire_time:
>                 os.unlink(filepath)
> 
> -- 
> Andrew McNamara, Senior Developer, Object Craft
> http://www.object-craft.com.au/
> _______________________________________________
> Albatross-users mailing list
> Albatross-users at object-craft.com.au
> https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albatross-users

-- 
     ________________________________________________________________________
                Mike Barrett | "I used to read, now I go to raves."
             mike at daboyz.org | -- Random MUNI Rider, speaking
              www.daboyz.org |    to my friend Allison.
     ------------------------+-----------------------------------------------



More information about the Albatross-users mailing list