The Transaction container.
||The Transaction container.|
A transaction serves as:
* A container for all objects involved in the transaction.
The objects include application, request, response, session
* A message dissemination point. The messages include awake(),
respond() and sleep().
When first created, a transaction has no session. However, it will
create or retrieve one upon being asked for session().
The life cycle of a transaction begins and ends with Application's
||Methods defined here:|
- __init__(self, application, request=None)
- Get the corresponding application.
- Send awake() to the session (if there is one) and the servlet.
Currently, the request and response do not partake in the
awake()-respond()-sleep() cycle. This could definitely be added
in the future if any use was demonstrated for it.
- End transaction.
This method should be invoked when the entire transaction is
finished with. Currently, this is invoked by AppServer. This method
removes references to the different objects in the transaction,
breaking cyclic reference chains and speeding up garbage collection.
- dump(self, file=None)
- Dump debugging info to stdout.
- Return the duration, in seconds, of the transaction.
This is basically the response end time minus the request start time.
- Return Exception instance if there was any.
- Check whether a server error occured.
- Return true if the transaction has a session.
- Get the corresponding request.
- Respond to the request.
- Get the corresponding response.
- Return the current servlet that is processing.
Remember that servlets can be nested.
- Return the session for the transaction.
A new transaction is created if necessary. Therefore, this method
never returns None. Use hasSession() if you want to find out if
a session already exists.
- setError(self, err)
- Set Exception instance.
Invoked by the application if an Exception is raised to the
- setResponse(self, response)
- Set the corresponding response.
- setServlet(self, servlet)
- Set the servlet for processing the transaction.
- setSession(self, session)
- Set the session for the transaction.
- Send sleep() to the session and the servlet.
Note that sleep() is sent in reverse order as awake()
(which is typical for shutdown/cleanup methods).
- writeExceptionReport(self, handler)
- Write extra information to the exception report.
Data descriptors defined here:
- dictionary for instance variables (if defined)
- list of weak references to the object (if defined)