CAT-SOOP API: catsoop.session

Simple session handling using the cslog package.

View Source

Members

  • catsoop.session.EXPIRE (int)

    Number of seconds since last action to keep a session as valid. Defaults to two weeks.

 

  • catsoop.session.SESSION_DIR (str)

    The directory where sessions will be stored.

 

  • catsoop.session.VALID_SESSION_RE (Pattern)

    Regular expression matching a valid session id name (32 hexadecimal characters)

 

  • catsoop.session.get_session_data (function, lines 92-103)

    Returns the session data associated with a given session ID

    Parameters:

    • context: the context associated with this request
    • sid: the session ID to look up

    Returns: a dictionary mapping session variables to their values

 

  • catsoop.session.get_session_id (function, lines 62-89)

    Returns the appropriate session id for this request, generating a new one if necessary.

    As a side-effect, deletes all expired sessions.

    Parameters:

    • environ: a dictionary mapping environment variables to their values

    Returns: a tuple (sid, new), where sid is a string containing the session ID, and new is a Boolean that takes value True if the session ID is new (just now generated), and False if the session ID is not new.

 

  • catsoop.session.new_session_id (function, lines 53-59)

    Returns a new session ID

    Returns: a string containing a new session ID

 

  • catsoop.session.set_session_data (function, lines 106-118)

    Replaces a given session's data with the dictionary provided

    Parameters:

    • context: the context associated with this request
    • sid: the session ID to replace
    • data: a dictionary mapping session variables to values

    Returns: None