Reopen ticket #32088, django.contrib.sessions, get_expiry_date() func problem

116 views
Skip to first unread message

ahmad khalili

unread,
Jan 22, 2022, 4:32:51 PM1/22/22
to Django developers (Contributions to Django itself)
Confusing return value in SessionStore('some_session') .get_expiry_date(),  example:

   from datetime import datetime
from django.contrib.sessions.backends.db import SessionStore
my_session = SessionStore()
my_session.get_expiry_date()
# this return new created sessions expiration time(14 days after datetime.now()) this is expected and logical but:
  my_session = SessionStore( 'some_session' )
my_session.get_expiry_date()
# this return new created sessions expiration time too, unexpected, this should return my_session expiration time

Here in this example django force us using my_session._get_session_from_db().expire_date instead my_session.get_expiry_date(), but one simple question: why we should do additional work when we saied to django 'we have specific db session?

In last reply in ticket #32088 i described a bit more.






Reply all
Reply to author
Forward
0 new messages