Back to index

moin  1.9.0~rc2
Classes | Functions | Variables
MoinMoin.web.session Namespace Reference

Classes

class  MoinSession
class  SessionService
class  FileSessionService

Functions

def _get_session_lifetime

Variables

tuple logging = log.getLogger(__name__)

Function Documentation

def MoinMoin.web.session._get_session_lifetime (   request,
  userobj 
) [private]
Get session lifetime for the user object userobj
Cookie lifetime in hours, can be fractional. First tuple element is for anonymous sessions,
second tuple element is for logged-in sessions. For anonymous sessions,
t=0 means that they are disabled, t>0 means that many hours.
For logged-in sessions, t>0 means that many hours,
or forever if user checked 'remember_me', t<0 means -t hours and
ignore user 'remember_me' setting - you usually don't want to use t=0, it disables logged-in sessions.

Definition at line 48 of file session.py.

00048 
00049 def _get_session_lifetime(request, userobj):
00050     """ Get session lifetime for the user object userobj
00051     Cookie lifetime in hours, can be fractional. First tuple element is for anonymous sessions,
00052     second tuple element is for logged-in sessions. For anonymous sessions,
00053     t=0 means that they are disabled, t>0 means that many hours.
00054     For logged-in sessions, t>0 means that many hours,
00055     or forever if user checked 'remember_me', t<0 means -t hours and
00056     ignore user 'remember_me' setting - you usually don't want to use t=0, it disables logged-in sessions."""
00057     lifetime = int(float(request.cfg.cookie_lifetime[userobj and userobj.valid]) * 3600)
00058     forever = 10 * 365 * 24 * 3600 # 10 years
00059 
00060     if userobj and userobj.valid and userobj.remember_me and lifetime > 0:
00061         return forever
00062     return abs(lifetime)

Here is the caller graph for this function:


Variable Documentation

Definition at line 21 of file session.py.