The Translate Handler
| T |
First, the handler checks the PythonDontHandle Apache configuration directive to see if this is a request that the Python site should decline.
If it's not, it does the following:
- Instantiates an object of the URL class, which will represent the current URL. The constructor for this class breaks down the URL as described in Infrastructure Perspective: HTTP Transaction. The constructed object is stored in req.url.
- Sets req.secure to true iff this is an SSL request.
- Instantiates an object of the URLs class, which is used to create new URLs through percent substitution. The constructed object is stored in req.urls.
- Copies the filename of the Python script, as well as the module path (the .-separated package path for use in a Python import statement) from req.url to req, where Apache expects a filename back from the handler.
- Parses any cookies using the utils.cookies module, which uses the Python standard library module Cookie, and places the result in req.cookies.
- Checks for a site login using the utils.session module. If a user is logged in, req.login is her username; otherwise, req.login is None.
- Logs the request using the debugging module.
- Instructs Apache to invoke the Dispatch handler when the time comes to send a document back to the user.
If a Python exception occurs during any of this processing, the handler triggers a 404 Not Found error, which does not give the user much information about exactly what went wrong. The entire Python exception, however, is sent to the debugging log.

