在 2010年12月10日星期五UTC+8下午9时57分20秒,Tom Evans写道: > > On Fri, Dec 10, 2010 at 1:27 PM, Stodge <[email protected] <javascript:>> > wrote: > > I have SESSION_EXPIRE_AT_BROWSER_CLOSE set to True in my settings. > > When the user visits my custom login page a new session is created for > > them in the database. The expiry time is set to two weeks. > > > > If I then close the browser, the expiry hour/minute are adjusted but > > it's still set to two weeks in the future. Shouldn't the expiry date > > be set to the current date? > > > > If I re-open the browser, login and then close the browser, the > > session expiry time is still set to two weeks. Shouldn't the expiry > > date be set to the current date? The session is expired because I have > > to re-login when I visit the site again. > > > > Thanks > > > > SESSION_EXPIRE_AT_BROWSER_CLOSE denotes whether the session cookie is > set as a session cookie (browser removes the cookie when it closes) or > whether it is a permanent cookie (with lifetime equal to the expiry > date set in the model). > > It does not affect anything to do with stored sessions, so the session > expiry date does not change in the DB, your browser just loses the > session id when it is closed, and so when it is re-opened it can no > longer access the (still valid, and not expired) session. > > Cheers > > Tom >
Thanks, your reply helps me a lot! -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.

