The request object is a static object referring to the currently handled request, which contains everything you need in order to take action. The most important aspect here is the request.env property, which contains an Environment object that is just the same as self.env for models. This environment is bound to the current user, which is not in the preceding example, because we used auth='none'. The lack of a user is also why we have to sudo() all our calls to model methods in the example code.
If you're used to web development, you'll expect session handling, which is perfectly correct. Use request.session for an OpenERPSession object (which is quite a thin wrapper around the Session object of werkzeug), and request.session.sid to access the session ID. To store session values, just treat request.session as a dictionary, as shown in the following example:
request.session['hello'] = 'world' request.session.get('hello')