The session module provides functions for getting information about a session

Functions

FunctionParametersReturn ValueDescription
get_session_user(session_id)session_id: The numerical identifier of a sessionThe user id for the specified session

Can raise the following exceptions:

        utilities.SessionNotFoundException when no session with the given ID exists
   

get_session_info(session_id)session_id: The numerical identifier of a sessionReturns a SessionInfo object

The SessionInfo object has the following attributes:

        SessionInfo.getUser(): Get the user id, same as server.get_session_user
        SessionInfo.getTimeStamp(): Currently unused
        SessionInfo.getSessionUUID(): Unique ID that identifies a record in DT 443.
        SessionInfo.getStartTime(): Returns a java.sql.Timestamp instance when the session was started
        SessionInfo.getEndTime(): java.sql.Timestamp instance or None if the session hasn't ended yet
        SessionInfo.getReason(): Currently unused


Can raise the following exception:

        utilities.SessionNotFoundException when no session with the given ID exists
      

open_clientless_session(user)

 user: The user logged into the sessionReturns a unique ID of the new clientless session

Starts a clientless session on behalf of a user

The session stays open until closeClientlessSession is called.

Can raise the following exception:
        utilities.SessionNotFoundException when no session with the given ID exists

close_clientless_session(clientless_session_id)



Closes a clientless session


Can raise the following exception:

        utilities.SessionNotFoundException when no session with the given ID exists






Classes

ClassDescription
ClientlessSession(object)

Context manager for clientless sessions

The clientless session is sent a shutdown command when the context is left. If there are still modules running in the session they first need to conclude before the session is shutdown.

Example usage:
        Opening module 100000 in a new session as R41 and reading the return value from on_web_load()

from customizing import utilities
with utilities.ClientlessSession('R41') as session:
   session.open_module(module_id='100000')
   data = session.get_return_value(module_id='100000', timeout=5)
PY

Functions

FunctionParametersReturn ValueDescription
get_user_context()

    


Gets the current user context of this jython session
set_user_context(user)

Sets the current user context of this jython session

Classes

ClassDescription

UserContext(object)

  

Context manager for setting the user context of the current jython session

Example usage:
        Creating a project as R41 with object protection set:


from customizing import utilities
with utilities.UserContext('R41'):
    pojo = utilities.create_pojo('Project', attributes={})
    utilities.save_pojo(pojo)
PY